[英]Getting error “file is encrypted or not a database” in SQLite DataBase?
我在C#中使用SQLite数据库并尝试对其进行加密,但是当我在Connection.SetPassword中设置密码时,它给了我上面的错误。
connection.SetPassword("12345");
trans=connection.BeginTransaction();
我在BeginTransaction()
方法上遇到错误。 有什么方法可以解决该问题并成功将密码设置为SQLite数据库。
设置密码后,您需要打开连接。
请遵循以下示例:
connection = new SQLiteConnection(connString);
//Set the password
connection.SetPassword("12345");
//Open the connection
connection.Open();
connection.Close();
如果要连接到相同的数据库并删除密码,请执行以下操作:
connection = new SQLiteConnection(connString);
connection.SetPassword("12345");
connection.Open();
connection.ChangePassword("");
connection.Close();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.