• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

[newbie] SQLitening + VB.Net?

Started by littlebigman, May 01, 2010, 05:37:45 AM

Previous topic - Next topic

littlebigman

Hello,

For some reason, I missed SQLitening while looking for client/server solutions of SQLite, so I'm eager to give it a try.

The client application will be written in VB.Net: If someone has already gone through this, I'd like to know how to use SQLitening from VB.Net, ideally with basic examples to connect, create a table, insert a record, read records, and disconnect.

Thank you.

PS: Out of curiosity, would an HTTP-capable server application (ie. where the client would use any HTTP client library to talk to an SQLite server using the text-based HTTP protocol) have significant drawbacks compared to SQLitening?

Rolf Brandt

QuotePS: Out of curiosity, would an HTTP-capable server application (ie. where the client would use any HTTP client library to talk to an SQLite server using the text-based HTTP protocol) have significant drawbacks compared to SQLitening?
The big difference would be SPEED. SQLitening is fast - very fast!

I have not used it in VB.net yet, just in VB6. It works great with VB6.
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

littlebigman

I'll see if I or someone can write a prototype with a simple HTTP server as front-end that calls the SQLite DB as the back-end, and send data as plain text to the client application, and see how it performs.

In the mean time, to get a VB.Net app to call the SQLitening DLL's, do I just need to somehow translate the following Include files into VB.Net?

SQLitening 1.30\Inc\

Thank you.

Rolf Brandt

Exactly.

I am adding the VBNet includes for an older version of SQLitening (v1.10). Not all declares will be correct anymore but they should give you an idea how to things running.
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fred Meier

The include file Rolf posted will call SQLitening directly while the SQLiteningS.Inc will
call SQLiteningS.Dll which in turn will call SQLitening.Dll.  Use the one that fits
VB.Net the best.  If VB.Net parm passing is same as VB6 then you probably want to use
SQLiteningS.Inc.

Quote
#========================<[ SQLitening API's ]>=========================
SQLitening comes with three different API's as follows:
   Basic     ---  Dll name is SQLitening.Dll
             ---  Include name is SQLitening.Inc
             ---  All routines begin with sl.
   Special   ---  Dll name is SQLiteningS.Dll
             ---  Include name is SQLiteningS.Inc
             ---  All routines begin with sls.
   Universal ---  Dll name is SQLiteningU.Dll
             ---  Include name is SQLiteningU.Inc
             ---  All routines begin with slu.

All DLL's are written in PowerBASIC and use the SDECL (aka STDCALL)
convention for parameter passing.  SDECL specifies that the declared
procedure uses the "Standard Calling Convention" as defined by Microsoft. 
When calling an SDECL procedure, parameters are passed on the stack from
right to left and the stackl is automatically cleaned before execution
returns to the calling code. 

PowerBASIC allocates strings using the Win32 OLE string engine. 
This allows you to pass strings from your program to DLLs, or
API calls that support OLE strings.


   Which API or DLL should you use?

Basic:: Always try to use the Basic API.  If you language supports passing
OLE strings both ByVal and ByRef then you should be able to use the Basic
API.  OLE strings are allocated using the Win32 OLE string engine.  There
are some routines in the Basic API that will probably only work with
PowerBASIC.  slSelAry is one that passes an array and therefore may only
work in PowerBASIC.  You may need to modify the include file
(SQLitening.Inc) to support your language

Special:: If your language supports OLE string passing but only ByRef
(Visual Basic) then the Special API will probable work for you.  The
language must also support optional parameter passing.  The slSelAry is
not available in this API.  You will need to modify the include file
(SQLiteningS.Inc) to support your language This DLL is a front-end to the
Basic API. 

Universal:: If your language does not support OLE strings then the Special
API will probable work for you.  This API will work for any language that
can call a standard Dll.  The parameter passing is patterned after the
Windows API.  The slSelAry is not available in this API.  You will need to
modify the include file (SQLiteningU.Inc) to support your language This
DLL is a front-end to the Basic API.  Documentation about parameter passing
is located in the include file.

littlebigman

Thanks guys. I'll give it a shot.

beardedGuru

Hi Littlebigman,
I have been using Sqlite successfully with VB.Net for quite some time. Its been a fruitful experience. Issues trying to go multi-user (my needs are not really client/server but more multi-threaded) led me to VistaDB but that is turning to another sad story. Then I discovered Sqlitening.  I have been experimenting with the Sqlitening + VB.Net 2008 Express combination trying to open a database but with no success.
I wonder if you or anyone else have had any success interfacing Sqlitening to VB.Net 2008.
As a first step, I have been trying to open a database - I am using the Sample.vb3 that came with vr1.40. I have used the sample VB.Net 2008 code from xsigns -
http://www.sqlitening.com/support/index.php?topic=3169.msg16265#msg16265

I have experimented with both the SqliteningS.dll and the Sqlitening.dll - slsOpen(path,"E0") - where the variable 'path' is the full path to the database. In all cases I get the following error (etBO.dll is my VB.Net class library):

A first chance exception of type 'System.BadImageFormatException' occurred in etBO.dll
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)


Any leads or details from those who have successfully followed this path would be highly welcomed

To Fred,
Is it possible for those of us without access to PowerBasic to get plain text listing of the Example*.BAS that come with version 1.40  in the hope that we could learn a thing or two from them.

Thanks

GB


Rolf Brandt

QuoteIs it possible for those of us without access to PowerBasic to get plain text listing of the Example*.BAS that come with version 1.40  in the hope that we could learn a thing or two from them.

You don't need PowerBasic to read the Example*.bas files They are text files. You can open them with Notepad, Notepad++, PSPad, or any other editor.
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

beardedGuru

Thanks Rolf.  That was quick. I have already followed your advice and I now await responses to the vb.net issues

beardedGuru

The Sqlitening and Sqlite DLLs (Win32) require an x86 platform while my VB.Net 2008 express solution was compiling to x64. Unfortunately, the express editions from Microsoft do not enable target platform selection by default. Several work arounds are available. I used the one by Ken Tucker ( http://www.onteorasoftware.net/post/Changing-the-target-cpu-in-VB-express-2008.aspx). All is now working ok although running under IIS7 is still a no go area

GB