如何使用密码连接到sqlite数据库
我有一个sqlite数据库,我想从我的C#程序使用数据库的密码进行连接。我使用Navicat的,我设定的密码“测试” 加密数据库文件,然后通过代码我的连接字符串是:如何使用密码连接到sqlite数据库
_connection = new SQLiteConnection("Data Source=MedExpress.db;Version=3;Password=\"test\";");
或
_connection = new SQLiteConnection("Data Source=MedExpress.db;Version=3;Password=test;");
但是,这是行不通的。
的错误是:File opened that is not a database file file is encrypted or is not a database
我可以连接到数据库,而像这样的密码:
_connection = new SQLiteConnection("Data Source=MedExpress.db;Version=3;");
我的问题是如何设置密码SQLite数据库,并从C#程序连接使用System.Data.SQLite
这是连接字符串,密码
Data Source=filename;Version=3;Password=myPassword;
正如你说,你用的Navicat设置sqlite的加密。 加密意味着你已经加密,它是从密码设置为不同的数据库,该数据库..
在设置密码到数据库试试这个代码..
//create file
SQLite.SQLiteConnection.CreateFile("c:\\mydatabase file.db3")
Dim cn As New SQLite.SQLiteConnection
//set password
cn.ChangePassword("paxword")
//remove password
cn.ChangePassword("")
先取下加密..
如何设置数据库密码? – ddarellis 2012-03-06 15:28:06
检查了吗? http://*.com/questions/1381264/password-protect-a-sqlite-db-is-it-possible – AnarchistGeek 2012-03-06 15:31:41
你能帮我这个http://*.com/questions/16030601/sqlite-unable-到开放式数据库文件被加密或 - 是 - 不-A-数据库-C – Mogli 2013-04-16 07:04:41