Re: [sqlite] Dotnet C# support

2005-10-28 Thread Justin Greenwood
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-




 







Re: [sqlite] Object Relational Mapping Tools with Sqlite

2004-12-31 Thread justin . greenwood
MyGeneration is a template based code generator that runs in the Win32
environment. It is 100% free and supports SQLite. There is not yet a set
of templates that generate code for a specific SQLite supported framework,
but the Meta-Data API supports SQLite, so writing your own templates
should be a fairly simple task.

http://www.mygenerationsoftware.com/


> On Thu, 30 Dec 2004 10:41:50 -0800, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
>> Has anyone been successful using an object relational mapping tool with
>> Sqlite?  I'm looking for such a tool that has a non-commercial free
>> license.
>
> For what language?
>
>
> Kirk Haines
>




[sqlite] Freeware code generator now supports SQLite

2004-10-19 Thread justin . greenwood
MyGeneration software has added SQLite support to thier freeware template
based code generator.

http://www.mygenerationsoftware.com/

MyGeneration has a generic meta-data API that supports 9 databases with
more on the way. The meta-data (which includes columns, indeces, foreign
keys, etc) is made available in the templates which are written in
JScript, C#, VBScript, or VB.Net. among other things, you can generate a
middle tier, SQL scripts, documentation, export data, etc.

I personally added the support for SQLite to MyGeneration, so if anyone
out there finds it useful, please send me some feedback. I havn't had much
of a test group. In fact, I'm the only guy that's tested it so far. ;) I
also wrote a short article about collecting meta data from SQLite which
can be found on my blog:

http://justingreenwood.blogspot.com/2004/10/sqlite-100-free-database.html

I love SQLite! I'm going to be using it in my next project. Thanks to all
the people that are maintaining it!