Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Im getting the error

"Cound not save; currently locked by another user."

 

the error is occuring at

system.data.oledb.oledbcommand.executecommandtexterrorhandling

system.data.oledb.oledbcommand.executecommandtextfor singleresult

system.data.oledb.oledbcommand.executecommandtext

system..............

 

can anyone help me trap this error so that I dont try to execute my insert statement when the database is locked?

Thanks

Posted

I have a Try Catch statement

The problem is that if the catch executes the program stops.

I want to check and see if its "currently locked by another user" so the error never occures.

Posted

You can do multiple catch statements for each error and handle the error accordingly. Your application doesnt need to stop if your error handling code can catch the error, show the error, and keep going.

 

try
{
   // You code goes here
}
catch(OleDbException xec)
{
   // Handle this error here
}
catch(Exception exc)
{
   // Handle general errors here
}
finally
{
   // Cleanup goes here
}

..::[ kleptos ]::..
Posted

If you have the right catch block, your program should never end. Its when the error is not catchable by the catch blocks you have or if you have no catch blocks in your application, then your looking at application failure.

 

If you have a general exception catch block and you still get the .NET Framework error box, it means the error that was thrown is not handled by System.Exception. Just take a look at the error message and usually it will tell you what exception was thrown, then just add a catch block for that exception (put the special catch blocks before the general exception).

 

You should be all set. HTH

..::[ kleptos ]::..

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...