【发布时间】:2013-09-06 15:37:45
【问题描述】:
我的应用使用sqlite-net-wp8 for Windows Phone 8 来管理本地数据库。
似乎从未将数据库文件写入 IsoStore(如 IsoStoreSpy 所示)。
不会抛出异常。
我尝试了以下方法:
将 SQLite for Windows Phone 从 3.7.1.16 升级到 3.8.0.2(一个极其痛苦的过程)
-
按照Working with sqlite in windows phone 8 a sqlite net version for mobile 中的建议提供绝对和相对路径。
SQLite.SqliteConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, filename)) SQLite.SqliteConnection(filename) 向 SQLite.SQLiteConnection 显式提供 SQLiteOpenFlags
其他随机的东西
这是我的代码(我使用的是USE_WP8_NATIVE_SQLITE)
string filename = "data.db";
string seqStr = "CREATE TABLE ...";
using (SQLiteConnection db = new SQLite.SQLiteConnection(filename,
SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite, true))
{
db.BeginTransaction();
db.Execute(seqStr);
db.Commit();
db.Close();
}
我的想法已经用完了。如果有人可以帮助我,我将不胜感激。
【问题讨论】:
-
您为什么要自己
Close()ing 数据库连接?using不应该为你做那件事吗? -
您好我有一个疑问,无论数据库可能是什么,sql lite 或其他东西,在 windows 手机中,文件只会保存在隔离存储中,对吗?或者如果文件保存在其他地方。
标签: c# sqlite windows-phone-8