Asp.net中使用Sqlite数据库的方法
程序员文章站
2024-03-08 21:14:58
实际运用中当我用sqliteadmin以及sqlite expert professional 2软件新建sqlite数据库的时候在asp.net中是无法运用的,老是报错:...
实际运用中当我用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而已…
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.