Link to home
Create AccountLog in
Avatar of skimox
skimoxFlag for United States of America

asked on

Record locking on classic ASP

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()
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of skimox

ASKER

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.
Avatar of skimox

ASKER

Thanks very much Steve, I got it working.