在WinRT上创建新的SQLite数据库?

时间:2020-12-29 05:33:43

I want to create a new database from C# code in my WinRT app. I searched the Web and the way to do that appears to be the SQLiteConnection.CreateFile() method. However, that method does not exist in the SQLite namespace, at least in the WinRT version. I installed SQLite using the NuGet packge name "sqlite-net" and included the sqlite3.dll into my project. I do see properly methods like CreateTable(), Query(), etc. but not CreateFile(). Where is it? Or does the WinRT package use a different method for creating database files from code?

我想用WinRT应用程序中的c#代码创建一个新的数据库。但是,这个方法在SQLite名称空间中不存在,至少在WinRT版本中不存在。我使用NuGet packge名称“SQLite -net”安装了SQLite,其中包括sqlite3。dll到我的项目。我确实看到了一些正确的方法,比如CreateTable()、Query()等等,但不是CreateFile()。在哪里?或者WinRT包使用不同的方法从代码创建数据库文件?

1 个解决方案

#1


5  

var db = new SQLiteConnection(databasePath, SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite);

is how I did it.

我就是这么做的。

#1


5  

var db = new SQLiteConnection(databasePath, SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite);

is how I did it.

我就是这么做的。