Asp中使⽤Sqlite数据库的⽅法
实际运⽤中当我⽤SqliteAdmin以及SQLite Expert Professional 2软件新建Sqlite数据库的时候在ASP.NET中是⽆法运⽤的,⽼是报错:⽂件不是⼀个合法的数据库。后来采⽤⼀种⽅法,就是直接在ASP.NET⾥⾯利⽤引⽤⼊的DLL新建数据库就可以⽤了。
string datasource = "d:\\test.db"; //数据库⽂件的地址
System.Data.SQLite.SQLiteConnection.CreateFile(datasource); //产⽣⽂件
这样产⽣出的test.db就可以在asp中运⽤了,此时你即使⽤SqliteAdmin以及SQLite Expert Professional 2软件打开它在⾥⾯建表都不影响它的使⽤了。
对Sqlite的操作其实跟Access⾮常像的,只不过OleDB开头的都变成了SQLite⽽已…
DRIVER=SQLite3 ODBC
Driver; Database=mydb.db; LongNames=0; Timeout=1000; NoTXN=0;SyncPragma=NORMAL; StepAPI=0;This is just one connection string sample for the wrapping OdbcConnection class that calls the underlying ODBC Driver. See respective ODBC driver for more connection strings to use with this class.
DRIVER=SQLite3 ODBC
Driver; Database=mydb.db; LongNames=0; Timeout=1000; NoTXN=0;SyncPragma=NORMAL; StepAPI=0;
Data Source=filename;Version=3;
Data Source=filename;Version=3;UseUTF16Encoding=True;
Data Source=filename;Version=3;Password=myPassword;
asp数据Data Source=filename;Version=3;Legacy Format=True;
Data Source=filename;Version=3;Read Only=True;
Data Source=filename;Version=3;Pooling=False;Max Pool Size=100;
Data Source=filename;Version=3;DateTimeFormat=Ticks; The default value is ISO8601 which activates the use of the ISO8601 datetime format
Data Source=filename;Version=3;BinaryGUID=False; 如果把Guid作为⽂本存储需要更多的存储空间
Data Source=filename;Version=3;Cache Size=2000; Cache Size 单位是字节
Data Source=filename;Version=3;Page Size=1024; Page Size 单位是字节
Data Source=filename;Version=3;Enlist=N;
Data Source=filename;Version=3;FailIfMissing=True; 默认情况下,如果数据库⽂件不存在,会⾃动创建⼀个新的,使⽤这个参数,将不会创建,⽽是抛出异常信息
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.
()
Data Source=filename;Version=3;Journal Mode=Off; This one disables the rollback journal entirely.
Data Source=filename;Version=3;Journal Mode=Persist; This one blanks and leaves the journal file on disk after a commit. Default behaviour is to delete the Journal File after each commit.
Data Source=filename;Version=3;Synchronous=Full;
Full specifies a full flush to take action after each write. Normal is the default value. Off means that the underlying OS flushes I/O's.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论