I've used the C# .net provider for SQLite quite a bit. You can use SQL3
with these providers, you just have to add something to the connection
string to tell the driver which version you're using and also the text
encoding (UTF8Encoding=true;Version=3;). To create a new database, you
just have to add the "New=True" key/value pair to the connection string.
Here are some links to get you started:
Microsoft.Net 1.x ADO.Net Provider
http://sourceforge.net/projects/adodotnetsqlite
Here's some sample code:
---
SQLiteConnection Conn = new SQLiteConnection();
Conn.ConnectionString = "Data
Source=diary.db;New=True;Compress=True;Synchronous=Off";
Conn.Open();
SQLiteCommand Cmd = new SQLiteCommand();
Cmd = Conn.CreateCommand();
Cmd.CommandText = "CREATE TABLE GOALS(GOALS_ID integer primary key ,
CATEGORY varchar (50), PRIORITY integer , SUBJECT varchar (150) ,
DESCRIPTION varchar (500),START_DATE datetime , COMPLETION_DATE datetime)" ;
Cmd.ExecuteNonQuery();
Cmd.CommandText="CREATE TABLE NOTES (NOTES_ID integer primary key
,NOTES_DATE datetime ,NOTES_TEXT varchar (8000) )";
Cmd.ExecuteNonQuery();
Cmd.CommandText =" CREATE TABLE REMINDERS (REMINDER_ID integer primary
key ,REMINDER_DATE smalldatetime ,SUBJECT varchar (150) ,DESCRIPTION
varchar (500) , ALARM1_DATE datetime ,ALARM2_DATE datetime ,ALARM3_DATE
datetime ,EMAIL_ALARM bit )";
Cmd.ExecuteNonQuery();
Cmd.CommandText ="CREATE TABLE TODO ( TODO_ID integer primary
key,CATEGORY varchar (20),PRIORITY int, PERCENT_COMPLETE float,
START_DATE datetime ,END_DATE datetime , SUBJECT varchar (150) , DETAILS
varchar (8000) ";
Cmd.ExecuteNonQuery();
Cmd.CommandText ="CREATE TABLE CATEGORIES (CATEGORY_ID INTEGER PRIMARY
KEY,CATEGORY_NAME varchar (25))";
Cmd.ExecuteNonQuery();
Cmd.Dispose();
Conn.Close();
-
There is also a new .net 2.0 provider:
Microsoft.Net 2.0 ADO.Net Provider
http://sourceforge.net/projects/sqlite-dotnet2
Gregory Letellier wrote:
i'm trying tu use sqli3 with vb. net
he create the db but not the table..
what is the mistake ?
i've this code
Imports System.Runtime.InteropServices
Public Class Form1
CharSet:=CharSet.Ansi)> _
Public Structure sqlite_callback
Public Void As Long
Public I1 As Long
Public s1 As String
Public s2 As String
End Structure
Public Declare Function sqlite3_open Lib "sqlite3.dll" (ByVal
Filename As String, ByRef Handle As Long) As Long
Public Declare Function sqlite3_exec Lib "sqlite3.dll" (ByVal
Handle As Long, ByVal Query As String, ByRef CallbackFunction As
sqlite_callback, ByRef CallBackArgs As Long, ByRef Erreur As String)
As Long
Public Declare Function sqlite3_close Lib "sqlite3.dll" (ByVal
Handle As Long) As Long
Public Declare Function sqlite3_errmsg Lib "sqlite3.dll" (ByVal
Handle As Long) As String
Public Sub Main()
Dim lRet As Long
Dim lHandle As Long
Dim sErreur As String
Dim sSQL As String
lRet = sqlite3_open("c:\test.db", lHandle)
sSQL = "CREATE Table Toto(titi varchar(15));"
lRet = sqlite3_exec(lHandle, sSQL, Nothing, Nothing, sErreur)
sqlite3_close(lHandle)
End Sub
End Class
Darren Lodge a écrit :
Thankyou!
Darren Lodge
Software Engineer
CAP
0113 222 2058 (direct)
0113 222 2000 (switchboard)
0113 222 2001 (fax)
-Original Message-
From: Peter Berkenbosch [mailto:[EMAIL PROTECTED] Sent: 28 October
2005 09:19
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Dotnet C# support
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Sigh..
http://www.google.com/search?hl=nl&q=SQLite+C%23&btnG=Google+zoeken&meta
=
Darren Lodge wrote:
Hi there,
Is there a version which will work for dotnot?
Darren Lodge
Software Engineer
CAP
0113 222 2058 (direct)
0113 222 2000 (switchboard)
0113 222 2001 (fax)
- --
+---+--+
: Peter Berkenbosch: :
:: t: +31 (0) 64 84 61653 :
: PeRo ICT Solutions: f: +31 (0) 84 22 09880 :
: Koemaad 26: m: [EMAIL PROTECTED] :
: 8431 TM Oosterwolde: w: www.pero-ict.nl :
+---+--+
: OpenPGP 0x0F655F0D (random.sks.keyserver.penguin.de) :
+--+
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
iD8DBQFDYd7g9bwznA9lXw0RAnb4AJ9oRUkvbXX5aX0HhXZEl6Lv4KNPyACgiUrq
yXTEUWDFVPk97iM5u14V1B4=
=0ECQ
-END PGP SIGNATURE-