violetstarlight
Programmer
Bare with me because I am somewhat new to VB and ADO.
Is there a way to lock a record in SQL Server using a client side cursor?
I am trying to lock a record so that another user doesn't have access if someone else has it opened. I am currently using ADO with a server side cursor, with pessimistic locking and a forward only cursor type. This accomplishes what I'm trying to do BUT only by accident. I am getting a timeout error instead of a record locked error. HELP?
I have a connection and recordset variable declared at the module level because the function is in a class. The recordset results are stored in class variables.
sp = "GetSelectedThreadResponse '" & vData & "'"
Set m_cnResp = New ADODB.Connection
If m_cnResp.State = adStateClosed Then
' class method that i created to open
' the connection.
g_objADOConnection.OpenDBConnection m_cnResp
End If
m_cnResp.CursorLocation = adUseServer
Set m_rsResp = New ADODB.Recordset
m_rsResp.Open sp, m_cnResp, adOpenForwardOnly, adLockPessimistic
Let me know if any further details are needed.
Thank you so much!!!
Shaun
Is there a way to lock a record in SQL Server using a client side cursor?
I am trying to lock a record so that another user doesn't have access if someone else has it opened. I am currently using ADO with a server side cursor, with pessimistic locking and a forward only cursor type. This accomplishes what I'm trying to do BUT only by accident. I am getting a timeout error instead of a record locked error. HELP?
I have a connection and recordset variable declared at the module level because the function is in a class. The recordset results are stored in class variables.
sp = "GetSelectedThreadResponse '" & vData & "'"
Set m_cnResp = New ADODB.Connection
If m_cnResp.State = adStateClosed Then
' class method that i created to open
' the connection.
g_objADOConnection.OpenDBConnection m_cnResp
End If
m_cnResp.CursorLocation = adUseServer
Set m_rsResp = New ADODB.Recordset
m_rsResp.Open sp, m_cnResp, adOpenForwardOnly, adLockPessimistic
Let me know if any further details are needed.
Thank you so much!!!
Shaun