FIX: RDO Resultset.Update Using ODBC Cursors Does Not Time Out If Data Is LockedID: Q223074
|
If you're trying to update your rdoResultset on an rdoConnection with a CursorDriver of rdUseOdbc, the attempt to update the data in your database will not time out if that data is locked.
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
When you attempt to update data that is locked, most client-server databases, such as SQL Server and Oracle, keep trying to update that data until the length of time specified in the QueryTimeout value has expired.
With RDO 2.0 prior to Visual Studio 6.0 Service Pack 3, the QueryTimeout information was not specified in the attempt to update and the attempt would never time out.
This problem only occurs when using an rdoConnection with a value of rdUseOdbc for the CursorDriver property. With all other values for the CursorDriver property, this behavior does not occur.
Private Sub Form_Load()
Dim cn1 As rdoConnection, cn2 As rdoConnection
Dim rs1 As rdoResultset
Dim strConn As String, strSQL As String
strConn = "Driver={SQL Server};Server=MyServer;" & _
"Database=pubs;UID=MyUID;PWD=MyPWD;"
strSQL = "SELECT * FROM Authors"
Set cn1 = New rdoConnection
cn1.CursorDriver = rdUseOdbc
cn1.Connect = strConn
cn1.EstablishConnection
Set rs1 = cn1.OpenResultset(strSQL, rdOpenKeyset, rdConcurValues)
Set cn2 = New rdoConnection
cn2.CursorDriver = rdUseOdbc
cn2.Connect = strConn
cn2.EstablishConnection
cn2.BeginTrans
strSQL = "UPDATE Authors SET Au_FName = 'Test1' " & _
"WHERE Au_ID = '" & rs1!Au_ID & "'"
cn2.Execute strSQL
rs1.Edit
rs1!Au_FName = "Test2"
rs1.Update
cn2.RollbackTrans
cn2.Close
Set cn2 = Nothing
rs1.Close
Set rs1 = Nothing
cn1.Close
Set cn1 = Nothing
End Sub
This code assumes that you are using RDO 2.0 to communicate with SQL Server 6.5 or 7.0. You need to modify the connection string to communicate with your database. If you're not using SQL Server, you might also need to modify the query strings.Additional query words:
Keywords : kbservicepack kbRDO kbRDO200 kbVBp600 kbVS600sp2 kbVS600SP1 kbVS600sp3fix
Version : WINDOWS:5.0,6.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 19, 1999