c# - Sqlite数据库中的加密和解密?

标签 c# .net winforms sqlite system.data.sqlite

我想在.Net中创建一个不同的项目。它将用于加密和解密SQLite数据库。我正在使用此代码进行加密,目前正在运行:

SQLiteConnection cnn = new SQLiteConnection("Data Source=c:\\test.db3");
cnn.Open();
cnn.ChangePassword("mypassword");


但是我想解密数据库,为此,我使用以下代码进行解密:

SQLiteConnection cnn = new SQLiteConnection("DataSource=c:\\test.db3;Password=mypassword");

cnn.Open();
cnn.ChangePassword(null);


但是代码cnn.ChangePassword(null);显示以下错误:

   The call is ambiguous between the following methods or properties: 'System.Data.SQLite.SQLiteConnection.ChangePassword(byte[])' and 'System.Data.SQLite.SQLiteConnection.ChangePassword(string)' 


我找到了上面代码的有用链接

http://gater3.rssing.com/chan-3257136/latest.php

但是我没有在哪里做错。

需要帮助。

最佳答案

先尝试一下

cnn.ChangePassword(String.Empty);


然后

cnn.ChangePassword((String)null);


要么

cnn.ChangePassword(default(byte[]));

关于c# - Sqlite数据库中的加密和解密?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23564927/

相关文章:

c# - 如何使 lambda 查询可为空?

c# - 知道文件被访问 IIS

c# - System32 是否仍需要安装屏幕保护程序?

c# - 实现 INotifyPropertyChanged - 是否存在更好的方法?

c# - 在 ASP.NET Core MVC AddControllers 配置期间注册服务

c# - 如何指定 AddIn 进程名称?

c# - 使用 StreamWriter 后文件为空

.net - VS2017 15.3 解决方案文件中的新 GlobalSection 是什么?

c# - 如何在 TreeView 的每个节点旁边添加一个按钮?

.net - .NET 中非矩形形式的平滑边缘