我正在尝试在我的Windows 8.1 Modern UI应用程序中实现数据库。我已经成功地为Windows Phone 8.1应用程序创建了这个,但是在新的Windows 8.1应用程序中不起作用。
当我实例化SQLiteConnection时,我遇到了一个SQLiteException,消息是“无法打开数据库文件:MyAppBase.db(CannotOpen)”。
我遵循以下步骤: 1. 将“sqlite-net”添加到Nuget参考中; 2. 在项目引用中选中“SQLite for Windows Runtime(Windows 8.1)”和“Microsoft Visual C++ 2013 Runtime Package for Windows”; 3. 将生成目标设置为x86。
如何使它起作用?
当我实例化SQLiteConnection时,我遇到了一个SQLiteException,消息是“无法打开数据库文件:MyAppBase.db(CannotOpen)”。
public static DatabaseHelper Instance
{
get
{
if (_instance == null)
{
_instance = new DatabaseHelper();
}
return _instance;
}
}
public DatabaseHelper()
{
_connection = new SQLiteConnection(DATABASE_NAME);
_connection.CreateTable<UserEntity>();
}
我遵循以下步骤: 1. 将“sqlite-net”添加到Nuget参考中; 2. 在项目引用中选中“SQLite for Windows Runtime(Windows 8.1)”和“Microsoft Visual C++ 2013 Runtime Package for Windows”; 3. 将生成目标设置为x86。
如何使它起作用?