Unable to open the database file
c#, connection, sqlite
Solution
I got the same exception when trying to open databases that are on the network drive (path starts with "\\myServer\myDbFile...") and I resolved it by putting `true` to the `parseViaFramework` parameter in connection constructor.
sql_con = new SQLiteConnection(a, true);
Problem
``` private void SetConnection() { string a = string.Format(@"Data Source={0};Version=3;New=False;Compress=True;", "~/lodeDb.db"); sql_con = new SQLiteConnection(a); } private void ExecuteQuery(string txtQuery) { SetConnection(); sql_con.Open(); sql_cmd = sql_con.CreateCommand(); sql_cmd.CommandText = txtQuery; sql_cmd.ExecuteNonQuery(); sql_con.Close(); } ``` When I run `sql_cmd.ExecuteNonQuery`, Sqlexception is : "Unable to open the database file". "lodeDb.db" file on my hosting, I think data source is wrong. If database file in online hosting, how to set datasourse for connection? Permission file is no problem here.