I am developing c# application with a backend sqlite db. In my application mutithreaded concepts are being used. All the threads will call the below mentioned code. then it will throw error as database is locked.
lock (localLockHandle)
{
SQLiteCommand cmd = conn.CreateCommand();
cmd.CommandText = sqlExpr;
int ireturn = cmd.ExecuteNonQuery();
return ireturn;
}
Is there any way to get rid from this database lock error. i am opening and closing the connection after each process. even sometimes it throws this lock error. please give me a solution as it is very critical for me.
Thanks