我跟着这个教程导入现有数据库http://wp.qmatteoq.com/import-an-already-existing-sqlite-database-in-a-windows-8-application/复制我的数据库项目文件和设置建设行动内容之后更新的SQLite数据库值,我复制数据库孤立storage.Now时我尝试更新数据库中的值,并查看我的绑定列表框的变化,我不是能看到changes.When我使用独立存储资源管理器,查看数据库,该值已在DB.But改变查询它不回到我的更新values.I正在使用这两种情况下相同的连接字符串。无法后importing-的Windows Phone
//copy DB from installation folder to isolated storage
private async Task CopyDatabase()
{
bool isDatabaseExisting = false;
try
{
StorageFile storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync("sample.db");
isDatabaseExisting = true;
}
catch
{
isDatabaseExisting = false;
}
if (!isDatabaseExisting)
{
StorageFile databaseFile = await Package.Current.InstalledLocation.GetFileAsync("sample.db");
await databaseFile.CopyAsync(ApplicationData.Current.LocalFolder);
}
}
//update the value
dbConn = new SQLiteConnection(DB_PATH);
dbConn.Query<resources>(" update resources SET isFavorite = 'True' WHERE resourceId =" + rid);
}
// Query database to populate list box
string DB_PATH = Path.Combine(ApplicationData.Current.LocalFolder.Path, "sample.db");
private SQLiteConnection dbConn;
dbConn = new SQLiteConnection(DB_PATH);
List<resources> retrievedpdf = dbConn.Query<resources>("select * from resources where categoryId=" + noid + " AND typeId=1").ToList<resources>();
pdflist.ItemsSource = retrievedpdf;
我能够查看exploreer变化,但查询返回未经修改的值。
当我改变我的选择query..I得到错误时,表不列入在当前上下文中存在 –
@PrasannaAarthi我所做的更改。 – Jaihind
Thankyou .. bt我仍然收到错误“bool不包含tolist()的defenition,当我尝试列表 retrievepdf = dbConn.Table ().ToList()。其中(x => x.categoryId.Equals(noid )&& x.typeId.Equals(1).ToList()); –