0

I am using SQLite Database in C# and trying to encrypt it but when I am setting the Password in Connection.SetPassword it is giving me above error.

connection.SetPassword("12345");
trans=connection.BeginTransaction();

I am getting the error on BeginTransaction() method. Is there any way to resolve it and set password successfully to SQLite Database.

1 Answer 1

1

You need to open the connection after setting the password.

Follow this example:

 connection = new SQLiteConnection(connString);
 //Set the password
 connection.SetPassword("12345");
 //Open the connection
 connection.Open();
 connection.Close();

If you want to connect to the same DB and remove the password then do as following:

 connection = new SQLiteConnection(connString);
 connection.SetPassword("12345");
 connection.Open();
 connection.ChangePassword("");
 connection.Close();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.