How to connect to sqlite database with password

前端 未结 3 2069
没有蜡笔的小新
没有蜡笔的小新 2021-02-07 10:25

I have a sqlite database and I want to connect from my C# program using a password for the database. I am using Navicat and I set encrypt database file with password \"test\" an

3条回答
  •  攒了一身酷
    2021-02-07 10:52

    This is the connection string with password

    Data Source=filename;Version=3;Password=myPassword;
    

    As you stated that you use navicat to set the sqlite encryption. Encryption means that you've encrypted the database it's different from setting a password to a database..

    in setting a password to a database try this code..

    //create file 
    SQLite.SQLiteConnection.CreateFile("c:\\mydatabase file.db3")
    Dim cn As New SQLite.SQLiteConnection
    //set password
    cn.ChangePassword("paxword")
    //remove password
    cn.ChangePassword("")
    

    Remove the encryption first ..

提交回复
热议问题