SQLiteConnection - ConnectionString



This property is used to set the database-file and database options.

The ConnectionString can only be set when the Connection is closed.

The ConnectionString cannot be set to null.

The Format of the ConnectionString is: "AttributeName1=value1;AttributeName2=value2;..."


ConnectionString Attributes

Data Source

The filename of the database (eg. "c:\test.db")


"2" - SQLite 2.x (default)

"3" - SQLite 3.x


"True" - If the database already exists, it is deleted and a new database is created

"False" (default) - An existing database file is used


"True" - Enables NTFS-File-Compression if a windows machine with NTFS filesystem is used

"False" (default) - Does not enable NTFS-File-Compression


"True" - Uses UFT8-Encoding

"False" (default) - Does not use UFT8-Encoding


"True" - Uses UFT16-Encoding

"False" (default) - Does not use UFT16-Encoding

Cache Size

default: 2000

This setting is passed to SQLite. Their website says:

[..] number of database disk pages that SQLite will hold in memory at once. Each page uses about 1.5K of memory. The default cache size is 2000. If you are doing UPDATEs or DELETEs that change many rows of a database and you do not mind if SQLite uses more memory, you can increase the cache size for a possible speed improvement.

Related Link: http://www.sqlite.org/pragma.html



"Normal" (default)


This value is passed to SQLite - See "PRAGMA synchronous;" in the SQLite-Documentation!

Related Link: http://www.sqlite.org/pragma.html


"ISO8601" (default)





This value is empty by default.


Example Code

using Finisar.SQLite;
// [snip] - As C# is purely object-oriented the following lines must be put into a class:
SQLiteConnection sqlite_conn; // Declare the SQLiteConnection-Object

sqlite_conn = new SQLiteConnection(); // Create an instance of the object
sqlite_conn.ConnectionString = "Data Source=c:\\test-database.db;Version=3;New=True;Compress=True;"; // Set the ConnectionString
sqlite_conn.Open(); // Open the connection. Now you can fire SQL-Queries