Database connection error
I am using vb.net that is using Access97 tables. After my program runs several files through the program against the Access97 database I get a cmdrecordset error when stops the program. When I close my program and restart it it runs ok. My question is is there a way to catch this error and close and restart the program within my vb.net code? Thanks
The error is:
The connection cannot be used to perform the operation. It is either closed or invalid in this context. in GetRecordsetcmd.
Re: Database connection error
Suggestion number one would be to error trap the routine.
It appears that recordset is being closed and then you are trying to do something with it, so I would look at the code before the code that generates the error to see if it is getting closed.
BTW: What version of VB.NET are you using? It is helpful to select one of the version option buttons when creating a new thread as code that works with 2002/2003 might not work with 2005. :)
Re: Database connection error
2003.
How would I trap the error???
Re: Database connection error
Quote:
Originally Posted by lappling
2003.
How would I trap the error???
You wouldn't trap the error. You would fix it. When the application crashes in the debugger it will tell exactly where the issue occurred, then you can look back and see where the connection was closed. You would also do well to stop using ADO and use ADO.NET instead.