ADO.NET 2.0 SQLite Data Provider
Version 1.0.18- Sep 1, 2005
Interop using SQLite 3.2.5
Written by Robert Simpson (robert@blackcastlesoft.com)
Released to the public domain, use at your own risk!

This provider was written and tested using the Visual Studio 2005 Beta 2 release.

The latest version can be downloaded here

Features:

Design-Time Support (new as of 1.0.14)

Until an installer is created, the steps for registering the provider for design-time support are:

  1. Register the System.Data.SQLite.DLL in the Global Assembly Cache either by using the .Net 2.0 version of GACUTIL, or through Administrative Tools -> Microsoft .NET Framework 2.0 Configuration.
  2. Through a command-prompt or Windows Explorer, navigate to the SQLite.NET\bin\Designer folder and execute the INSTALL.CMD file.
  3. NOTE:  Enabling Design-Time support for SQLite causes the SQLite Provider to be registered in your machine.config.   If you have already added the XML shown below to your app.config in your applications, you need to remove it.  If you don't, it will cause a unique constraint violation when you run your program.
  4. Delete the test.exe.config file from the SQLite.NET\bin folder -- it is no longer necessary.

DbFactory Support (Non-Compact Framework)

In order to use the SQLiteFactory and have the SQLite data provider enumerated in the DbProviderFactories methods, you must add the following segment into either your application's app.config or the system's machine.config located in the %SystemRoot%\Microsoft.Net\Framework\v2.xxxx\Config folder:

<configuration>
  <system.data>
    <DbProviderFactories>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.18.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" /> </DbProviderFactories> </system.data> </configuration>

If you choose to install the Visual Studio Design-Time support for SQLite, you must not add the above XML to your app.config.  The installer will have already added it to your machine's machine.config file.

Compiling for the Compact Framework

Just change the target platform from Win32 to Compact Framework and recompile.  The Compact Framework has no support for enumerating attributes in an assembly, therefore all user-defined collating sequences and functions must be explicitly registered.  See the testce sample application for an example of how to explicitly register user-defined collating sequences and functions.

Many thanks to the fine folks at http://sourceforge.net/projects/sqlite-wince for the Windows CE code!

Distributing The SQLite Engine and ADO.NET Assembly

For Win32 platforms, only the System.Data.SQLite.DLL file in the bin folder should be distributed with your application(s).  This DLL contains both the managed wrapper and the native SQLite3 codebase.

For Compact Framework platforms, your application should reference the System.Data.SQLite.DLL file in the bin\CompactFramework folder.  The System.Data.SQLite.DLL and SQLite.Interop.DLL files from the bin\CompactFramework folder must be distributed with your application(s).  They contain the managed wrapper and the native SQLite3 codebase respectively.  The Compact Framework does not currently support managed C++, thus the reason for two files.

Development Notes Regarding the SQLite 3 Source Code

Steps for merging the sqlite3 core codebase:

This section is obsolete, but remains for historical purposes.  The 1.0.11+ versions of the ADO.NET 2.0 SQLite provider make significant changes to the core sqlite3 codebase in order to support C++ /clr compiling.  Specifically, all the implicit casts throughout the core codebase must be modified.  There are several hundred of these casts and they must be fixed up every time a new sqlite version is released.

  1. Download the latest sqlite3 source from http://www.sqlite.org/download.html
  2. Extract the source code to the SQLite.Interop\src directory of this project
  3. Open the src\select.c file.
  4. Add #include "../interop.h" to the top of the file where the other include's are.
  5. Scroll down the select.c file to around line 748.  Change the name of the function static void generateColumnNames to static void _generateColumnNames (note the underscore in front of the name).
  6. Compile it.

Version History

1.0.18 - September 1, 2005

1.0.17 - August 26, 2005

1.0.16 - August 24, 2005

1.0.15 - August 22, 2005

1.0.14 - August 16, 2005

1.0.13 - August 8, 2005

1.0.12 - August 5, 2005

1.0.11 - August 1, 2005

1.0.10 - June 10, 2005

1.0.09a - May 25, 2005

1.0.09 - May 24, 2005

1.0.08 Refresh - Mar 24, 2005

1.0.08 - Mar 11, 2005

1.0.07 - Mar 5, 2005

1.0.06 - Mar 1, 2005

1.0.05 - Feb 25, 2005

1.0.04 - Feb 24, 2005

1.0.03 - Feb 23, 2005

1.0.02 - Feb 21, 2005