Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This is my first application with sqlite3. I am using finishar.sqlite and everything works perfectly.

But since I've realesed my app's beta version, users reported this error:

Unable to open database.

But on some user's computers and my computer it's working fine.

What I have tried:

I tried this:
C#
public static DataTable veriAl(string sqliteKomut)
    {
        DataTable dt = new DataTable();
        using (SQLiteConnection sqlCon = new SQLiteConnection("Data Source=" + Application.StartupPath + "\\Veri\\tkt.db;Version=3;New=False;Compress=True;UTF8Encoding=True;DateTimeFormat=CurrentCulture"))
        {
            sqlCon.Open();
            sqlDa = new SQLiteDataAdapter(sqliteKomut, sqlCon);
        }
        sqlDa.Fill(dt);
        return dt;
    }


and this style codes
C#
SQLiteConnection sqlCon = new SQLiteConnection("Data Source=" + Application.StartupPath + "\\Veri\\tkt.db;Version=3;New=False;Compress=True;UTF8Encoding=True;DateTimeFormat=CurrentCulture");
public static DataTable veriAl(string sqliteKomut)
   {
       DataTable dt = new DataTable();

       sqlCon.Open();
       sqlDa = new SQLiteDataAdapter(sqliteKomut, sqlCon);
       sqlCon.Close();

       sqlDa.Fill(dt);
       return dt;
   }
Posted
Updated 14-Mar-16 23:52pm

1 solution

Make sure the database file is ok and you can open it in a sqlite viewer, and the file is not locked or in use.
 
Share this answer
 
Comments
Member 11941034 15-Mar-16 6:02am    
I am sure because on some user's computers and my computer it's working fine.
Mehdi Gholam 15-Mar-16 6:15am    
Then check if you are running 32bit or 64bit on the bad machine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900