How to connect to sqlite database with password
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 passwordcn.ChangePassword("paxword")//remove passwordcn.ChangePassword("")
Remove the encryption first ..
you can provide password via connection string;
Data Source=filename;Version=3;Password=myPassword;
Also, have a look at his link
hope it helps
Its very long time ago, but here is my solution that work's with LITEDB using connectionstring and password. But remember you need to set password in your db first. You can use this tool (LITE DB EXPLORER ) to create and manage your databases. https://github.com/JosefNemec/LiteDbExplorer
In App Config Add your connection string like this example:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="LiteDB" connectionString="Filename=.\Databases\Data.db"/> </connectionStrings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> </startup> </configuration>
And in C# code behind:
private static string LoadConnectionString(string id = "LiteDB") { try { return ConfigurationManager.ConnectionStrings[id].ConnectionString + ";password=your_pass"; } catch (Exception loadConnectionStringError) { Console.WriteLine("loadConnectionStringError: " + loadConnectionStringError.ToString()); return null; } }