I have developed a Windows Forms application that uses an Access database to store information. Using VS 2008.
While stress-testing the application (i.e. pressing buttons repeatedly to add/remove data items), I've come across error -2147467259, which tends to appear more on slower client machines, but is not very predictable.
I've had a look at this article http://support.microsoft.com/kb/286126
and although my symptoms are not exactly the same, it seems to be a similar issue.
I have tried using On Error to trap the error, check if it has the error code above and then Resume if it does, otherwise do other error processing.
This resolves the problem for the specific line of code that was producing the error before. But now other parts of the code are producing the same error.
As I didn't want my code full of On Error statements, I thought I would use Try/Catch blocks to trap the error instead. But this presents another problem, getting the code to resume execution if the error was the one mentioned above.
Catch ex As OleDB.OleDBException
If ex.ErrorCode = -2147467259 Then
' Do nothing
' Handle error
This works as it should because execution resumes after the Try block and has the same effect at Resume Next, right?
But if there are many lines within a function that could throw the exception then it's not so easy to go back to where the exception was thrown from.
So what is the best way to handle these types of error ? Or maybe I shouldn't be handling them, maybe there is a fundamental problem somewhere?