I've run into a bug where the second time I attempt to connect to a database, 
it fails. No exception is thrown but "SQLite error (21): misuse at line 110832 
of [a499ae3835]" pops out in the console.

After distilling the problem down, I've found that this code will always 
reproduce the error:


        public Boolean TestConnection()
        {
            try
            {
                using (SQLiteConnection conn = new SQLiteConnection("Data 
Source=agilent.db"))
                {
                    conn.Open();

                    Thread.Sleep(100);

                    conn.Close();
                }
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }

The function will always return true, but the second time (and all future 
times) you run it, the error (21) comes out on the console. Any operations on 
the db will fail at that point.

There must be something really obvious I'm missing here. The using statement 
should dispose the connection, and I'm calling close. Is there some flag I'm 
missing?

(using VS 2010, C#/WPF, latest System.Data.SQLite.dll)

Any guidance appreciated.

Phil
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to