VB6 - Could not update; currently locked Errors - PLEASE I NEED HELP HERE (1 Viewer)

alyonsal

New member
Local time
Today, 12:53
Joined
May 26, 2010
Messages
2
Hi

I am using VB6 to connect to an Access database, it works most of time but more regularly getting the Could not update; currently locked errors.

I have tried everything I can see on the web, ensuring the connection is closed and the correct locks and cursors etc, but still dont know what is causing this. The error also occurs when doing a read only SELECT query.

Dim cn As New ADODB.Connection
cn.mode = adModeShareDenyNone
Dim rs As New ADODB.Recordset
Dim connString As String


' Initialize the connection string.
If DBType = "SQL" Then
connString = ConnectionString
Else
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SystemPath & "\" & Table & ".mdb;Mode=ReadWrite;Persist Security Info=False"
'connString = "Provider=MSDASQL.1;DBQ=" & SystemPath & "\" & Table & ".mdb;Driver={Microsoft Access Driver (*.mdb)}"
End If
End If
cn.ConnectionString = connString
' Open the connection and start a transaction.
cn.mode = adModeShareDenyNone
cn.Open
cn.CursorLocation = adUseServer
Screen.MousePointer = 11
'Run SQL Command
If (rs.State = adStateOpen) Then rs.Close
If InStr(1, SQLStatement, "select", vbTextCompare) = 1 Then
rs.CursorLocation = adUseServer
rs.Open SQLStatement, cn, adOpenDynamic, adLockReadOnly
end if
 

DCrake

Remembered
Local time
Today, 12:53
Joined
Jun 8, 2005
Messages
8,632
TRy changing this to be a client side connection

cn.CursorLocation = adUseServer
 

alyonsal

New member
Local time
Today, 12:53
Joined
May 26, 2010
Messages
2
Thanks for your reply, I have also tried the client side cursor too, still same issue?

Ally
 

Users who are viewing this thread

Top Bottom