【发布时间】:2011-02-16 07:12:43
【问题描述】:
以下语句是否应该自动提交?我得到一个 IOException 试图在执行查询后删除文件。
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");
【问题讨论】:
-
实际的异常是什么?
-
异常是:“进程无法访问文件'data\test.db',因为它正被另一个进程使用。”
-
我也遇到这个错误,有没有找到解决办法?