我正在使用 System.Data.SQLite(版本 1.0.85.0)连接我的 SQLite 数据库。我想使用 SQLiteConnection.BackupDatabase() 方法创建数据库备份,但是它会抛出带有消息的 SQLiteException:“不是错误”(重复两次)。这是一些代码:
SQLiteConnection cnnIn = new SQLiteConnection("Data Source=test.db;foreign keys=True");
SQLiteConnection cnnOut = new SQLiteConnection("Data Source=backup.db;foreign keys=True");
cnnIn.Open();
cnnOut.Open();
cnnIn.BackupDatabase(cnnOut, "backup", "test", -1, null, -1);
cnnIn.Close();
cnnOut.Close();
错误来自 System.Data.SQLite.SQLite3.InitializeBackup(SQLiteConnection destCnn, String destName, String sourceName)
有谁知道哪里出了问题?
附言。我必须说错误信息有点误导:)
最佳答案
我使用相同的方法来执行方法,但是作为数据库名称,我使用main
:
cnnIn.BackupDatabase(cnnOut, "main", "main", -1, null, -1);
它适用于此更改吗?
关于c# - System.Data.SQLite BackupDatabase() 抛出 "not an error",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17298988/