[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Record locking question

Posted on 2006-04-20
2
Medium Priority
?
236 Views
Last Modified: 2010-04-23
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.
0
Comment
Question by:LAppling7775
  • 2
2 Comments
 
LVL 6

Expert Comment

by:willbdman
ID: 16497522
are you closing any connections to the database when you have finished with it - ie accessing records, add/edit/delete

You can use a try catch finally to contain any errors, however best scenario is for a user to not have to restart the program to get it working again. Try and isolate the problem which is causing the cmdrecordset error.

You can use a try catch to isolate what is going on. Do the following:-

Try

your code here

Catch exc As Exception

MessageBox.Show(exc.Message)
MessageBox.Show(exc.ToString())

Finally

Close all connections to database
0
 
LVL 6

Accepted Solution

by:
willbdman earned 2000 total points
ID: 16497542
Sorry forgot you need an End Try at end...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question