簡體   English   中英

在SQLite數據庫中出現錯誤“文件已加密還是未加密數據庫”?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM