不應該將以下語句設爲autocommited?我得到一個IOException試圖在執行查詢後刪除文件。儘管連接已關閉,SQLite鎖定文件
using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + AppDomain.CurrentDomain.BaseDirectory + "data\\test.db;Version=3;"))
{
connection.Open();
SQLiteCommand command = new SQLiteCommand("CREATE TABLE IF NOT EXISTS test (id INTEGER)", connection);
command.ExecuteNonQuery();
}
//throwing an IOException
File.Delete(AppDomain.CurrentDomain.BaseDirectory + "data\\test.db");
什麼是實際例外? – 2010-05-06 09:15:37
例外情況是:「進程無法訪問文件'data \ test.db',因爲它正在被另一個進程使用。」 – 2010-05-06 09:41:12
我也得到這個錯誤,是有史以來發現的解決方案?即使在等待幾秒或幾分鐘後,文件仍未解鎖,也可以使用 – Mizipzor 2010-11-18 12:52:29