lundi 27 avril 2015

database is locked exception on drop table

Im currently facing an issue with database is locked exceptions. I have a update function like

private void UpdateVersion(string version)
{
        string qry = "DROP TABLE IF EXISTS version; " +
                     "CREATE TABLE IF NOT EXISTS version ( version INTEGER NOT NULL );" +
                     "INSERT INTO version VALUES ("+version+");";
        try
        {
            SQLiteCommand cmd = new SQLiteCommand(qry, this.dbConnection);
            cmd.ExecuteNonQuery();
        }
        catch (SQLiteException ex)
        {
            // stuff
        }
    }

and i always get

{"database is locked\r\ndatabase is locked"}
ErrorCode   5
ResultCode  Busy

Thats a little bit weird because the same querry works in SQLite Browser (Like SQLiteStudio or DB Browser for SQLite) without any issues. I figured out that the exception is thrown on the first querry part (DROP TABLE). I'm facing this issue on every DROP TABLE in my code :/.

Does anyone have an idea? :)

Aucun commentaire:

Enregistrer un commentaire