System.Data.SQLite BackupDatabase()抛出"不是错误" [英] System.Data.SQLite BackupDatabase() throws "not an error"

查看:175
本文介绍了System.Data.SQLite BackupDatabase()抛出"不是错误"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆