Lui*_*ado 24
我使用SQLite版本3完美运行!你必须这样做:
//if the database has already password
try{
string conn = @"Data Source=database.s3db;Password=Mypass;";
SQLiteConnection connection= new SQLiteConnection(conn);
connection.Open();
//Some code
connection.ChangePassword("Mypass");
connection.Close();
}
//if it is the first time sets the password in the database
catch
{
string conn = @"Data Source=database.s3db;";
SQLiteConnection connection= new SQLiteConnection(conn);
connection.Open();
//Some code
connection.ChangePassword("Mypass");
connection.Close();
}
Run Code Online (Sandbox Code Playgroud)
此后如果用户试图打开数据库.会说管理员受保护或者数据库是加密的,还是不是数据库或损坏的文件!
归档时间: |
|
查看次数: |
22310 次 |
最近记录: |