Bug #27965 MyODBC 351/ ADO recordset.Requery method causes application crash
Submitted: 19 Apr 2007 22:44 Modified: 30 Aug 2007 6:35
Reporter: Erica Moss Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.14 OS:Windows (XP sp 2)
Assigned to: CPU Architecture:Any

[19 Apr 2007 22:44] Erica Moss
Description:
In the code below, the application will crash when the statement:
recset1.Requery  is run.  No error is generated but the following is seen if you inspect the recordSet object

RecSet1: AbsolutePage : <Application-defined or object-defined error> : PositionEnum_Param : Form1.Test()

An ODBC trace file is attached: SQL.LOG

I'm setting this to P2 rather than P1 since it has a workaround which would be to always close and reopen a recordset rather than to use the Requery method

How to repeat:
Setup:
mysql> DROP TABLE IF EXISTS ado_test;
mysql> CREATE TABLE ado_test (C1 INT PRIMARY KEY, C2 CHAR(20));
mysql> INSERT INTO ado_test VALUES (1, 'ONE'), (2, 'TW0');

VB Code
Private Sub Test()
    On Error GoTo EH
    Dim strSQL, strConn As String
    Dim connection1 As ADODB.Connection
    Dim recset1 As ADODB.Recordset
    Set connection1 = New ADODB.Connection
    Set recset1 = New ADODB.Recordset
    
    strSQL = "SELECT * FROM ado_test"
        
    strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _
        "SERVER=localhost;DATABASE=ado" & _
        ";USER=root;PASSWORD=mypass;OPTION=3;"
        
    ' open connection
    connection1.ConnectionString = strConn
    connection1.CursorLocation = adUseServer
    connection1.Open

    recset1.Open strSQL, connection1, adOpenStatic, adLockOptimistic, adCmdText
    recset1.MoveFirst
    
    recset1.Requery
    recset1.MoveFirst

    While Not recset1.EOF
        For Each fld In recset2.Fields
            Debug.Print fld.Name & ":" & fld.Value
        Next
    Wend
    
    recset1.Close
    Set recset1 = Nothing
    connection1.Close
    Set connection1 = Nothing
    Exit Sub
EH:
    Debug.Print Err.Description & " " & Err.Number & vbNewLine
End Sub
[22 Apr 2007 10:51] Louis Breda van
Hello,

I have the same problem over here.

Trying to de an refresh on a RS does crash the application.
Running msaccess 2003, mYODBC 3.51.14, MySQL5117 and windows VISTA64.

I had to change the code so that I could leave out the .requery

Louis
[26 Aug 2007 11:28] Kent Boortz
I can run the ADO regression test "rsrequery.vbs" with
the 3.51.19 driver with no problem.
[30 Aug 2007 6:35] Erica Moss
Retried against .19 and this does appear to have been spontaneously fixed