I am pulling my hair out trying to work out an error I'm having with my application. Basically I am getting random errors when trying to populate a dataset from an SQLite query. I can deal with the fact that it might not always return results from the SQLite DB because the tables may be locked, etc. but my code keeps failing and I'm unable to trap the error:
My code looks like this:
Dim ExQry As New SQLiteCommand(QryString, SQLConnect)
ExQry.CommandType = CommandType.Text
Dim da As New SQLiteDataAdapter(ExQry)
dasSpice.Clear()
Try
da.Fill(dasSpice, "Calls") 'Error occurs on this line
Catch ex As SQLiteException
Basically what happens is my code will get to the da.fill(dasSpice, "Calls") statement and throw an error:
A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in System.Data.SQLite.dll
However, this error is not caught in the catch statement, but instead my code will skip directly to the cell_formatting event and try to populate my gridview with empty data. Part of my form_load event is to go off and populate the dasSpice dataset and then return to populate another dataset and finally update the gridview. However, because it bombs out on the dasSpice dataset it never returns to populate the second dataset and hence gives me an empty gridview.
Is there anyway at all I can catch this error, or allow my code to return to the form_load event to continue on with the rest of the code? I can provide more detail if required.
Any help would be greatly appreciated as I'm totally at a loss with this. Thanks