It seems the SQLite Database is locked when I do a delete operation as below:
And I need to delete two times in order to refresh. What is the normal way to delete without any locking by the Sqlite Database?
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;
}
DeleteAsyncis not done when you call it again? Is there a sync Delete? Try with aThread.Sleepright after calling theDeleteAsyncto see if that's it