不应该将以下语句设为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