error: unable to open database file, SQLiteException was unhandled

Posted by rose on Stack Overflow See other posts from Stack Overflow or by rose
Published on 2011-11-25T08:09:53Z Indexed on 2011/11/26 1:50 UTC
Read the original article Hit count: 640

My project has a reference to SQLite.Interop.066.dll and even after putting in the correct path to the SQLite database, the application is still unable to find it. A SQLiteException was unhandled is returned.

        SQLiteConnection conn = new SQLiteConnection();
        //SQLiteDataAdapter da;
        SQLiteCommandBuilder cb;
        DataTable dt=new DataTable();
        int row = 0;

        conn.ConnectionString = "Data Source=C:\\database\\info";
        conn.Open();

        DataRow dr = dt.NewRow();
        dr["name"] = txtName.Text;
        dr["address"] = txtAddress.Text;
        dr["phone"] = txtPhone.Text;
        dr["position"] = txtPosition.Text;
        dt.Rows.Add(dr);
        da.Update(dt);

        row = dt.Rows.Count - 1;
        txtName.Text = dt.Rows[row]["name"].ToString();
        txtAddress.Text = dt.Rows[row]["address"].ToString();
        txtPhone.Text = dt.Rows[row]["phone"].ToString();
        txtPosition.Text = dt.Rows[row]["position"].ToString();

        da.Fill(dt);

        cb = new SQLiteCommandBuilder(da);

        conn.Dispose();
        conn.Close();

The exception occur at line: conn.Open();
sorry for the mistake title error before...

© Stack Overflow or respective owner

Related posts about c#

Related posts about sqlite