Bug #28101 MyODBC 3/ADO batch updating is not working with adUseServer cursor location
Submitted: 25 Apr 2007 17:20 Modified: 14 Mar 2014 3:31
Reporter: Erica Moss Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Windows (XP sp2)
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[25 Apr 2007 17:20] Erica Moss
Description:
In the code below, an error is hit when the line:
recset1.MoveNext
is encountered the first time to move the record set from the first record to the second record:
"Row handles must all be released before new ones can be obtained. -2147217883"

This test works when the cursor location is set to adUseClient.

How to repeat:
SETUP:
DROP TABLE IF EXISTS ado_test;
CREATE TABLE ado_test (C1 INT PRIMARY KEY, C2 CHAR(20), C3 TIMESTAMP);
INSERT INTO ado_test VALUES (1, 'A'),(2, 'B');

VB CODE:
Sub Test()
    On Error GoTo EH
    Dim strSQL, strConn As String
    Dim connection1 As ADODB.Connection
    Dim recset1 As ADODB.Recordset
    Dim fld As Field
    Set connection1 = New ADODB.Connection
    Set recset1 = New ADODB.Recordset
    
    strSQL = "SELECT C1, C2 FROM ado_test"
        
        
    strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _
        "SERVER=localhost;DATABASE=ado" & _
        ";USER=root;PASSWORD=mypass;OPTION=35;"

  
   ' open connection
    connection1.ConnectionString = strConn
    connection1.CursorLocation = adUseServer
    connection1.Open
    
    strSQL = "SELECT C1, C2 FROM ado_test"
    recset1.Open strSQL, connection1, adOpenDynamic, adLockBatchOptimistic, adCmdText

    Debug.Print "curtype: " & recset1.CursorType
    Debug.Print "locktype: " & recset1.LockType
    recset1.MoveFirst
    
    If (recset1.Supports(adUpdateBatch)) Then
        While Not recset1.EOF
            For Each fld In recset1.Fields
                If fld.Type = adChar Then
                    fld.Value = "test"
                End If
            Next
            recset1.MoveNext
        Wend
        recset1.UpdateBatch
    End If
    
    recset1.Close
    Set recset1 = Nothing
    connection1.Close
    Set connection1 = Nothing
    Exit Sub
EH:
    Debug.Print Err.Description & " " & Err.Number & vbNewLine
    Resume Next
End Sub
[22 Oct 2007 14:54] Susanne Ebrecht
This bug is for MyODBC version 3.51. I fixed the version number of this bug report.
[5 Jan 2008 18:52] Erica Moss
Retested with MyODBC 3.51.22  Problem still exists
[13 Mar 2014 13:36] Omer Barnir
This bug is not scheduled to be fixed at this time.
[14 Mar 2014 3:31] Bogdan Degtyariov
Verified with 5.2 and 5.3
The problem still exists.