当我执行删除操作时,似乎SQLite数据库被锁定,如下所示:
我需要删除两次才能刷新。在没有Sqlite数据库锁定的情况下删除的常规方法是什么?
var ThisTrans = await db.QueryAsync<TransactionLine>("Select * From TransactionLine Where Tid = '" + PassInTransId + "'"); foreach (var line in ThisTrans) { var intDelStatus = db.DeleteAsync(line); } //- can I use this to close Connection?? but it does not work! db = null; --- solution private async Task<bool> DelTransactionLine(int PassInTransId) { //--1-- delete the selected transaction line var ThisTrans = await db.QueryAsync<TransactionLine>("Select * From TransactionLine Where Tid = '" + PassInTransId + "'"); foreach (var line in ThisTrans) { var intDelStatus = await db.DeleteAsync(line); } return true; }
答案 0 :(得分:1)
你能做点什么:
var ThisTrans = await db.QueryAsync<TransactionLine>("Select * From TransactionLine Where Tid = '" + PassInTransId + "'");
foreach (var line in ThisTrans)
{
var intDelStatus = await db.DeleteAsync(line);
}
要等到在尝试删除下一个操作之前返回的删除操作吗?