Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

record locking with ADO 1

Status
Not open for further replies.

TomSnider

Programmer
May 2, 2001
27
US
Has this topic, "Record locking in ADO", been discussed recently? I tried to search for it, but.....well you know. Anyway, I have a multiuser application using optimistic locking. I have placed error trapping code in the 'save' process to check for locking errors, and it correctly tells me of the error as it should. However, even after I do a 'cancelupdate' on the recordset, and then retry another edit, I keep getting an error. Do I need to 'refresh' the recordset? And if so, how do you refresh the recordset? I have searched for ADO record locking articles, but there are not many to be found. Any suggestions on reference material on the subject?

Thanks for any direction.

Tom Snider
San Antonio, Texas
 
The .Requerey method should 'refresh' the recordset. Are you clearing the errors object after handling the error? i think that could be your problem too. There is also a .Resync method of the recordset object, i've never used it but you might want to try it. Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
If you are using SQL SERVER, you can supply locking hints in your SQL. See: SERIALIZABLE and ROWLOCK in SQL Server Books Online.

Chip H.
 
Thanks Chip and Ruairi. The .requery did the trick regarding refreshing the recordset. And the problem about continuing to get an error after the first 'lock' error...was due to my not doing a .cancelupdate before any other operation on the recordset.

Anyway, thanks for the responses, I really appreciate the help.

Tom Snider
San Antonio, Texas
 
Could you please send me your error trapping code in your ADO save routine that detects the locking errors. I cant get VB to return a unique error number when an ADO locking error occurs and hence I cant tell if its caused by the record being locked, deleted by another user, etc. I would greatly appreciate any help and advice on how to correctly detect the various types of ADO locking errors.

Yours

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top