SQLite keeps the database locked even after the connection is closed

后端 未结 12 1301
故里飘歌
故里飘歌 2020-11-30 02:33

I\'m using System.Data.SQLite provider in an ASP.NET application (framework 4.0). The issue I\'m running into is that when I INSERT something in a table in the SQLite databa

12条回答
  •  独厮守ぢ
    2020-11-30 02:48

    I have the same problem. My scenario was after getting the data inside SQLite Database file I want to delete that file but it always throw an error "...using by other process". Even I dispose the SqliteConnection or SqliteCommand the error still occur. I've fixed the error by calling GC.Collect().

    Code snippet

    public void DisposeSQLite()
    {
        SQLiteConnection.Dispose();
        SQLiteCommand.Dispose();
    
        GC.Collect();
    }
    

    Hope this help.

提交回复
热议问题