Click to See Complete Forum and Search --> : How to lock record
Dan-Yeung
09-09-2002, 05:05 PM
Hello,
I need to lock the record when the SQL statement is executed. Do I use 2
- Pessimistic or 3 - Optimistic? Please refer the codes below.
SQLstr = " select * from TableA where account = '12345'"
Set Rs1 = Server.CreateObject("ADODB.Recordset")
Rs1.Open SQLstr, Conn, 1, 2
Thank you.
Dan-Yeung
I think you would use Pessimistic
"Dan-Yeung" <dan.yeung.wong@worldxchange.com> wrote:
>
>Hello,
>
>I need to lock the record when the SQL statement is executed. Do I use
2
>- Pessimistic or 3 - Optimistic? Please refer the codes below.
>
>SQLstr = " select * from TableA where account = '12345'"
>Set Rs1 = Server.CreateObject("ADODB.Recordset")
>Rs1.Open SQLstr, Conn, 1, 2
>
>Thank you.
>
>Dan-Yeung
Paul Clement
09-11-2002, 08:35 AM
On 9 Sep 2002 14:05:17 -0700, "Dan-Yeung" <dan.yeung.wong@worldxchange.com> wrote:
¤
¤ Hello,
¤
¤ I need to lock the record when the SQL statement is executed. Do I use 2
¤ - Pessimistic or 3 - Optimistic? Please refer the codes below.
¤
¤ SQLstr = " select * from TableA where account = '12345'"
¤ Set Rs1 = Server.CreateObject("ADODB.Recordset")
¤ Rs1.Open SQLstr, Conn, 1, 2
You can't lock a record (or page) with the above code. The locking occurs when you issue the Edit
method or place the row in edit mode (for pessimistic locking) and the Update method (when using
optimistic locking) for the Recordset.
You also must use a client-side cursor.
Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
devx.com
Copyright Internet.com Inc. All Rights Reserved