On 3 Feb 2012, at 3:33pm, <[email protected]> <[email protected]>
wrote:
> 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.
Please check the result codes returned by conn.Open() and conn.Close() the
first time through the loop. Your 'try' is catching only operations which
result in exceptions, not ones which result in non-zero result codes.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users