更新时间:2023-02-27 07:43:25
以下是我使用 SQLite 的方式:
Following is how I work with SQLite:
从
创建一个新的空白 c# 通用 Windows 平台应用程序.
Create a new blank c# Universal Windows Platform app.
右键单击项目的引用 -> 添加引用 -> 通用 Windows -> 扩展 -> 为通用应用平台添加 SQLite 及其依赖 Visual C++ 2015 Runtime for Universal Windows
Right click on the References of project -> Add Reference -> Universal Windows -> Extension -> add SQLite for Universal App Platform and its dependency Visual C++ 2015 Runtime for Universal Windows
项目节点右键->管理NuGet包->搜索SQLite.Net-PCL->安装默认版本3.0.5
Right click on the project node -> Manage NuGet packages -> Search SQLite.Net-PCL -> Install the default version 3.0.5
将您的代码更改为以下内容:
Change your code to the following:
using (var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), dbPath))
{
...
}