sqlite的在线备份使用System.Data.Sqlite [英] Sqlite Online Backup Using System.Data.Sqlite
本文介绍了sqlite的在线备份使用System.Data.Sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何SQLite数据库在本地的C#代码进行备份,而数据库仍然在线?所有联机备份API 的例子是C代码。
How can a sqlite database be backed up in native C# code while the database is still online? All of the online backup api examples are in C code.
推荐答案
联机备份API在的 System.Data.Sqlite 。 data.sqlite.org/index.html/doc/trunk/www/news.wiki\">version 1.0.80.0 - 2012年4月1日。同时也有像这样
The online backup API was added to System.Data.Sqlite
in version 1.0.80.0 - April 1, 2012. You can create a database backup while there are other external connections like so
using(var source = new SQLiteConnection("Data Source=ActiveDb.db; Version=3;"))
using(var destination = new SQLiteConnection("Data Source=BackupDb.db; Version=3;"))
{
source.Open();
destination.Open();
source.BackupDatabase(destination, "main", "main", -1, null, 0);
}
此外, BackupDb.db
如果它不存在,将创建
Also, BackupDb.db
will be created if it doesn't already exist.
这篇关于sqlite的在线备份使用System.Data.Sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文