![]() ![]() That Password=something would have to be removed from the connection string, because the password has been removed programmatically from the DB and the DB will try connecting with that. This scenario happens if you blank the password using conn.SetPassword("") and then try conn.ChangePassword("somethingelse") without first connecting to the database without the Password=something in the connection string. If you have an existing password and you want to change it, this is correct, but you also have to be sure the connection string is updated afterwards, or subsequent connections will fail with the file is encrypted error. So the code 2Toad provided to perform conn.ChangePassword("somethingelse") is only half-correct and doesn't take into account where you are, what else you've done, and what you want to do in the future. The database has had a password, and you want to change it.The database has never had a password, and you want to change it.You have a password in the connection string, but the database does not have one applied, or the password in the string does not match the DB.The database has had a password applied, and it is in the connection string.Or if you do conn.ChangePassword("somethingelse"), but still have Password=something in the connection string. If you haven't set a password on the database yet, this will result in the "file is encrypted" error, because the supplied password can't be used to decrypt an unencrypted database.īut this error can also happen if you try to use conn.SetPassword("something") after you already had another one in the connection string. As 2Toad said, this is correct: When you specify a password in the connection string, and the database already exists, SQLite assumes the database is encrypted and will try to decrypt it with said password. ![]() 2Toad's answer is mostly correct, but I wanted to add my own because there are some clarifications to be made. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |