We help IT Professionals succeed at work.

Record locking on classic ASP

skimox
skimox asked
on
227 Views
Last Modified: 2017-04-11
I need to do record locking in classic ASP.  I was able to get it working in ASP.NET using System.Transactions code on the same system that the classic ASP code is running.  The problem is protecting (linearizing access to) the classic read-modify-write cycle on a single record in an SQL Server 2012 database table.
Conceptually I need to do the following simple steps:
    lock_record()
    select cur_value from value_tbl where id_val = 1;
    next_value = cur_value + 1
    update value_tbl set cur_value = next_value where id_val = 1;
    unlock_record()
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Okay thanks Steve I will give it a try.  The example in the link you provided is in VB, not VBScript, so I will have some work to do.

I agree ASP.NET is much better than ASP but we have so much code written in ASP that converting it all to ASP.NET would be a huge project and is not feasible right now.

I did try to get ADO transactions to work in ASP but was unsuccessful.  Are there some versions of SQL Server that don't support transactions?  I know there are more expensive versions of SQL Server 2012 than what we have but I don't know how to check what version we have.  Clicking "About" on the SSMS Help menu doesn't tell me.

Author

Commented:
Thanks very much Steve, I got it working.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.