Asp.net Sqlite数据库 Asp.net中使用Sqlite数据库的方法
人气:0想了解Asp.net中使用Sqlite数据库的方法的相关内容吗,在本文为您仔细讲解Asp.net Sqlite数据库的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Asp.net,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.net中运用了,此时你即使用SqliteAdmin以及SQLite Expert Professional 2软件打开它在里面建表都不影响它的使用了。
对Sqlite的操作其实跟Access非常像的,只不过OleDB开头的都变成了SQLite而已…
.NET Framework Data Provider for ODBC
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.
SQLite3 ODBC Driver
DRIVER=SQLite3 ODBC Driver; Database=mydb.db; LongNames=0; Timeout=1000; NoTXN=0;SyncPragma=NORMAL; StepAPI=0;
SQLite.NET
Data Source=filename;Version=3;
Data Source=filename;Version=3;UseUTF16Encoding=True;
Data Source=filename;Version=3;Password=myPassword;
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
The default value is ISO8601 which activates the use of the ISO8601 datetime format
Data Source=filename;Version=3;BinaryGUID=False;
如果把Guid作为文本存储需要更多的存储空间
如果把Guid作为文本存储需要更多的存储空间
Data Source=filename;Version=3;Page Size=1024;
Page Size 单位是字节
Page Size 单位是字节
Data Source=filename;Version=3;Enlist=N;
Data Source=filename;Version=3;Max Page Count=5000;
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.
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.
加载全部内容