I'm using System.Data.SQLite (version 1.0.85.0) to connect with my SQLite database. I want to create backup of the database using SQLiteConnection.BackupDatabase() method, however it throws SQLiteException with message:"not an error" (repeated twice). Here is some code:
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();
The error comes from System.Data.SQLite.SQLite3.InitializeBackup(SQLiteConnection destCnn, String destName, String sourceName)
Does anyone knows what could be wrong?
PS. I must say error message is a bit misleading :)
I use the same method to perform methods, but as the database name, I use main
:
cnnIn.BackupDatabase(cnnOut, "main", "main", -1, null, -1);
Does it work with this change?
来源:https://stackoverflow.com/questions/17298988/system-data-sqlite-backupdatabase-throws-not-an-error