'Declaration Public Overrides Property ConnectionString As String
public override string ConnectionString {get; set;}
'Declaration Public Overrides Property ConnectionString As String
public override string ConnectionString {get; set;}
Resetting the ConnectionString on a closed connection resets all connection string values (and related properties).
The connection string is parsed immediately after being set. If errors in syntax are found when parsing, a runtime exception, such as System.ArgumentException, is generated. Other errors can be found only when an attempt is made to Open the connection.
The ConnectionString is similar to an OLE DB connection string. Values may be delimited by single or double quotes, (for example, name='value' or name="value"). Either single or double quotes may be used within a connection string by using the other delimiter, for example, name="value's" or name= 'value"s', but not name= 'value's' or name= ""value"". All blank characters, except those placed within a value or within quotes, are ignored. Keyword value pairs must be separated by a semicolon (;). If a semicolon is part of a value, it also must be delimited by quotes. No escape sequences are supported. The value type is irrelevant. Names are not case sensitive. Arguments names may occur only once in the connection string.
The following table lists the valid names for values within the ConnectionString.
Name | Description |
---|---|
Attach | The list of databases to attach, separated with semicolons. |
Automatic Index | Determines whether SQLite automatic indexing is enabled. Default value is true. |
Auto Vacuum | Determines what happens when a transaction that deletes data from a database is committed. See AutoVacuumMode for information on the supported values. |
Binary GUID | Determines how GUIDs are stored. If true - GUID columns are stored in binary form, otherwise GUID columns are stored as text. |
Busy Timeout | Sets an SQLite busy handler that sleeps for a specified amount of time when a table is locked. The handler will sleep multiple times until at least the specified number of milliseconds of sleeping have accumulated. After this the handler returns 0. Specifying this parameter will cause a call to sqlite3_busy_timeout function when connecting. |
Cache Size | The maximum number of database disk pages. Each page uses about 1.5 kilobytes 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. |
Cache Spill | Determines whether to allow spilling dirty cache pages to the database file in the middle of a transaction. The default value is true. |
Case Sensitive Like | Determines whether the LIKE operator performs case-sensitive comparison. By default, false. |
Cell Size Check | Determines whether to perform additional checks on database b-tree pages as they are initially read from disk. The default value is false. |
Checkpoint Full FSync | Determines whether the F_FULLFSYNC syncing method is used during checkpoint operations on systems that support F_FULLFSYNC. Default value is false. |
Connection Lifetime | When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by Connection Lifetime. The default value is 0 (connection always returns to pool). |
Connect Timeout -or- Connection Timeout | The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. The default value is 15. |
Count Changes | Determines whether whether the database engine should return the number of inserted, updated, or deleted rows. |
Data Source | The path and name or the database to which to connect. This parameter supports both file system paths and URI format. |
DateTime Format | The format of DATETIME values. If set to "Ticks", DATETIME values are expressed in ticks. Otherwise, Datetime fields are formatted according to ISO8601. |
Default Command Timeout | The time in seconds to wait while trying to execute a command before terminating the attempt and generating an error. 0 indicates no limit. |
Enable Load Extension | Determines whether an SQLite extension library can be loaded from the from the named file with the statement SELECT load_extension(file_name);. It can be useful, for example, for the full-text search modules. |
Encryption | Determines the encryption SQLite extension to use. Note that if you want to use encryption mode other than "None" (which means no encryption), you need to buy the corresponding extension separately and compile the SQLite engine with it. dotConnect for SQLite supports SEE, CEROD, SQLCipher, and SQLiteCrypt encryption extensions. |
Enlist | Determines whether the connection is automatically enlisted in the current distributed transaction. The default value is true. SQLite engine itself doesn't support distributed transactions. Our provider emulates this support to allow using TransactionScope class. This parameter is not supported in the .NET Standard 1.3 compatible assembly. |
FailIfMissing | Determines what to do when the database file is missing. If true, SQLiteConnection throws an exception if it cannot find the database file. If false, an empty database is created. |
Foreign Key Constraints | Determines whether the foreign key constraints are enforced. See SQLiteForeignKeyConstraints for the information about the supported values. |
Full Column Names | Determines the format of autogenerated names. If true, the database engine names columns according to format <table-name/alias> <column-name>. |
Full FSync | Determines whether or not the F_FULLFSYNC syncing method is used on systems that support it. |
Ignore Check Constraints | Determines whether the check constraints are enforced. Default value is false. |
Initialization Command | Specifies a database-specific command that should be executed immediately after establishing the connection. |
Journal Mode | Determines SQLite journal mode for the connection. For the list of the supported values see JournalMode. |
Journal Size Limit | The maximal size of the log file in bytes. If the journal file exceeds this size after commit, it is truncated. Negative values mean no limit. The default value is -1. |
Legacy File Format | Determines whether backwards compatibility of the database file is enabled. |
License Key | Specify your license key in this parameter. This is required only when using .NET Standard compatible assemblies. See Licensing .NET Standard (.NET Core) Projects for more information. |
Load Extension | Defines the list of SQLite extension libraries, which are loaded when the connection opens. Applied only when the Enable Load Extension connection string parameter is set to True. |
Locking | Determines database locking mode. For the list of the supported values see LockingMode. |
Max Page Count | The maximum number of pages in the database file. |
Max Pool Size | The maximum number of connections allowed in the pool. Setting the Max Pool Size value of the ConnectionString can affect performance. The default value is 100. |
Min Pool Size | The minimum number of connections allowed in the pool. The default value is 0. |
Page Size | The page size in newly created databases. Must be a power of two greater than or equal to 512 and less than or equal to 8192. |
Password | The user's password to connect to an encrypted database. |
Pooling | If true, by default, the SQLiteConnection object is drawn from the appropriate pool or is created and added to the appropriate pool. |
Read Only Database | Determines whether to open a database in a read-only mode. An exception is thrown if a database does not exist. Available only if the connection uses the UTF8 encoding. |
Read Uncommitted | Gets or sets the process isolation level. The default level is SERIALIZABLE (false). |
Recursive Triggers | Determines whether the recursive triggers are turned on. Default value is false. |
Reverse Unordered Selects | Determines whether the result of the SELECT statement without the ORDER BY clause will be retrieved in the reverse order of what it normally would. Default value is false. |
Secure Delete | Determines whether to overwrite the deleted data with zeroes. |
Short Column Names | Determines the format of autogenerated names. |
SQLiteCrypt License Key | The software license key for SQLiteCrypt extension. Necessary if connecting to an SQLiteCrypt encrypted database. |
Synchronous | Determines the synchronization mode of write operations. See SynchronizationMode for the list of supported values. |
Temp Store | Determines the location of temporary files - user's TEMP folder, custom folder, or RAM. See TempStoreMode for the list of supported values. |
Temp Store Directory | The directory to store temporary files in if Temp Store is set to File. |
Threads | The maximal number of auxillary threads the prepared statement can launch to assist with a query. Default value is 0, which means no auxillary threads are allowed. |
Transaction Scope Local | If there are several connections with the same connection string (which includes "Transaction Scope Local=true;") within a scope of TransactionScope, our provider will use only one connection internally. The default value is false. This parameter is also not supported in the .NET Standard 1.3 compatible assembly. |
UTF16 | Determines whether the connection uses UTF16 encoding. |
Validate Connection | Specifies whether to validate connections that are being got from the pool. |
WAL Auto Checkpoint | The write-ahead log auto-checkpoint interval - the number of the write-ahead log pages, after which the checkpoint is performed. |
Writable Schema | Determines whether the SQLITE_MASTER tables can be changed using UPDATE, INSERT, and DELETE statements. However note that editing SQLITE_MASTER table in such way can result in a corrupt database file. |
public void CreateSQLiteConnection() { string myConnString1 = "DataSource=mydatabase.db;"; SQLiteConnection sqConnection1 = new SQLiteConnection(myConnString1); sqConnection1.Open(); }
Public Sub CreateSQLiteConnection() Dim myConnString1 As String = _ "DataSource=mydatabase.db;" Dim sqConnection1 As New SQLiteConnection(myConnString1) sqConnection1.Open() End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2