System.Data.SQLite BackupDatabase()抛出"不是错误" [英] System.Data.SQLite BackupDatabase() throws "not an error"
问题描述
我使用System.Data.SQLite(1.0.85.0版本),与我的SQLite数据库连接。我想创建一个使用SQLiteConnection.BackupDatabase()方法的数据库备份,但它抛出SQLiteException与消息:没有错误(重复两次)。下面是一些代码:
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();
这个错误来自 System.Data.SQLite.SQLite3.InitializeBackup(SQLiteConnection destCnn,串了destname,字符串SOURCENAME)
有谁知道什么地方出错了?
Does anyone knows what could be wrong?
PS。我必须说,错误信息是有点误导:)
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?
这篇关于System.Data.SQLite BackupDatabase()抛出"不是错误"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!