SQLite數據庫連接字符串(C#)


Basic(基本的)
      Data Source=filename;Version=3;
Using UTF16(使用UTF16編碼)
      Data Source=filename;Version=3;UseUTF16Encoding=True;
With password(帶密碼的)
      Data Source=filename;Version=3;Password=myPassword;
Using the pre 3.3x database format(使用3.3x前數據庫格式)
      Data Source=filename;Version=3;Legacy Format=True;
Read only connection(只讀連接)
      Data Source=filename;Version=3;Read Only=True;
With connection pooling(設置連接池)
      Data Source=filename;Version=3;Pooling=False;Max Pool Size=100;
Using DateTime.Ticks as datetime format()
      Data Source=filename;Version=3;DateTimeFormat=Ticks;
 
Store GUID as text(把Guid作為文本存儲,默認是Binary)
     Data Source=filename;Version=3;BinaryGUID=False;

      如果把Guid作為文本存儲需要更多的存儲空間

Specify cache size(指定Cache大小)

      Data Source=filename;Version=3;Cache Size=2000;

      Cache Size 單位是字節

Specify page size(指定頁大小)
      Data Source=filename;Version=3;Page Size=1024;

      Page Size 單位是字節

Disable enlistment in distributed transactions
      Data Source=filename;Version=3;Enlist=N;
Disable create database behaviour(禁用創建數據庫行為)

      Data Source=filename;Version=3;FailIfMissing=True;

      默認情況下,如果數據庫文件不存在,會自動創建一個新的,使用這個參數,將不會創建,而是拋出異常信息

Limit the size of database(限制數據庫大小
      Data Source=filename;Version=3;Max Page Count=5000;
      The Max Page Count is measured in pages. This parameter limits the maximum number of pages of the database.

Disable the Journal File禁用日志回滾

      Data Source=filename;Version=3;Journal Mode=Off;

      This one disables the rollback journal entirely.

Persist the Journal File(持久)
      Data Source=filename;Version=3;Journal Mode=Persist;
 
 
基本連接Sqlite數據庫:

Data Source=mydb.db;Version=3;

--"Version" 的可能值: "2″ 指 SQLite 2.x (default);"3″ 指 SQLite 3.x


連接同時創建一個新的Sqlite數據庫:

Data Source=mydb.db;Version=3;New=True;

啟用壓縮連接Sqlite數據庫:

Data Source=mydb.db;Version=3;Compress=True;

指定連接Sqlite數據庫的緩存大小:

Data Source=mydb.db;Version=3;Cache Size=3000;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM