I have a program written in Visual Basic .NET.
One of the functions of the program is to move all of the program's data,
including a SQLite database to a different folder.
The program is a 32-bit application using System.Data.SQLite.dll.
I am having a problem that after I copy the data to the new folder, the
program fails when I try to delete the old folder. The error message says
that the folder cannot be deleted because the SQLite database file is in use
by another process.
The code I am using is:
' Close license database connection
If Not IsNothing(SQLconn) Then
If SQLconn.State <> ConnectionState.Closed Then
SQLconn.Close()
End If
SQLconn = Nothing
End If
' Move data files
'\\\\\ code to move files goes here
' Delete old directory
Directory.Delete(strOldLocation,
FileIO.DeleteDirectoryOption.DeleteAllContents)
The error occurs when I try to execute the "Directory.Delete" statement.
"SQLconn" is a SQLiteConnection to my database file. Once the connection is
closed & disposed of, what still has the .db file still open? How do I
close the file so I can delete it?
Thank you for any assistance.
Ray Andrews