I'm using SQLite3 database for a small level system. The problem is that when I try to rename the db file using IO file system, System.IO returns an exception that the file is being used by another process however I've already closed the connection using connection.Close() method. I searched on this topic but cold not find any thing useful for me. Someone please suggest me the right way to release an SQLite connection..
Thanks in Advance
One of the things I learned programming with SQLite is that closing the connection is simply not good enough. You need to wrap everything in a
using
block. Make sure yourSQLiteConnection
object is wrapped in ausing
block, yourSQLiteCommand
is wrapped in ausing
block and yourSQLiteDataReader
is wrapped in ausing
block. Your code should look similar to this: