Record Locking in MS SQL Server 2000 using VB app.
Posted on 2006-03-28
I converted the access database into ms sql server and I am using VB 6.0 app for front end interface. The problem is that I lost the record locking feature. The vb app does not recognize if the record is locked or not. I need to know the best way to have record locking for concurrent processes. Is there any stored procedure available that I can directly call or some other better way? Please let me know. Thanks!
Here is the code I am using for checking if the record is lock or not:
'Test method to determine whether a record is locked or not before editing it
Public Function IsItLocked(rstAny As ADODB.Recordset) As Boolean
On Error GoTo IsItLocked_Error
IsItLocked = False
rstAny.Fields(0).Value = rstAny.Fields(0).Value
If Err.Number = -2147467259 Then
IsItLocked = True
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description, vbCritical, "Unknown Error Found!"
Public Sub LockRecord(rstAny As ADODB.Recordset)
gblnInTrans = True
rstAny.Fields(0).Value = rstAny.Fields(0).Value 'record should lock occur here