S
S.L.
Hi, I'm testing locking in MS Access XP with ADO 2.7. My testing code is
below :
Set cnn = CurrentProject.Connection
rst.Open "select * from MTR1 where MTR1_CD = 'A' ", cnn, adOpenKeyset,
adLockPessimistic
Do While True
rst!MTR1_No = rst!MTR1_No + 1 ' <------ Line 1
rst.Update ' <----- Line 2
rst.Close : set rst = Nothing
Loop
I found that when I create 2 forms with the same code and run both, Error
about locking is detected on Line 2. By use Pessimistic locking, Should it
start locking on Line 1 and Should locking error (from second form) is
detected on Line 1 also, shoundn't it ? Otherwise, It's nothing different
from Optimistic locking.
TIA
below :
Set cnn = CurrentProject.Connection
rst.Open "select * from MTR1 where MTR1_CD = 'A' ", cnn, adOpenKeyset,
adLockPessimistic
Do While True
rst!MTR1_No = rst!MTR1_No + 1 ' <------ Line 1
rst.Update ' <----- Line 2
rst.Close : set rst = Nothing
Loop
I found that when I create 2 forms with the same code and run both, Error
about locking is detected on Line 2. By use Pessimistic locking, Should it
start locking on Line 1 and Should locking error (from second form) is
detected on Line 1 also, shoundn't it ? Otherwise, It's nothing different
from Optimistic locking.
TIA