| Bug #28222 | Getting recordset state loses all data in recordset | ||
|---|---|---|---|
| Submitted: | 3 May 2007 16:43 | Modified: | 22 May 2007 15:53 |
| Reporter: | Andy Lawton | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / ODBC | Severity: | S3 (Non-critical) |
| Version: | 3.51.14 | OS: | Windows (XP Sp2) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | ADO, ODBC, VB6 | ||
[22 May 2007 15:53]
Tonci Grgin
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at http://www.mysql.com/downloads/ Explanation: Hi Andy and thanks for your report. I used test case from Bug#27125 (see the discussion on rs.State ENUM values there) but it shows no problems in 3.51.15, so please upgrade. Modifications to test case: rsProducts.CursorLocation = CursorLocationEnum.adUseClient 'rsProducts.CursorType = CursorTypeEnum.adOpenStatic '28222 rsProducts.CursorType = CursorTypeEnum.adOpenForwardOnly rsProducts.LockType = LockTypeEnum.adLockReadOnly and rsProducts.Open(sSql) If rsProducts.State > 0 Then 'adStateClosed ' Fill the list box with the result records Do While Not rsProducts.EOF lbResults.Items.Add(rsProducts.Fields(0).Value.ToString & " / " & rsProducts.Fields(1).Value.ToString & " / " & rsProducts.Fields(2).Value.ToString) rsProducts.MoveNext() Loop If rsProducts.State > 0 Then rsProducts.Close() End If

Description: This used to work with VB6,MySQL V5.0.0, ODBC 3.51.14 We believe it also used to work with V5.0.37 and ODBC 3.51.12. But this bit of code does not work with 3.51.14 and 5.0.37 The when the dbs recordset is opened (line 1), it contains the database names on the server. However as soon as line 2 is executed, the recordset loses all data. How to repeat: This is the connection string: Provider=MSDASQL.1;Extended Properties="DRIVER={MySQL ODBC 3.51 Driver};OPTION=27;PWD=vai;PORT=0;SERVER=localhost;UID=vai" cnn.Open MySql.ConnectionString If cnn.Errors.Count = 0 Then Dim dbs As ADODB.Recordset Set dbs = New ADODB.Recordset With dbs line 1 .Open "SHOW DATABASES", cnn,adOpenForwardOnly, adLockReadOnly line 2 If .State = adStateOpen Then While Not .EOF etc etc Suggested fix: As a workaround, change to use a static cursor like this: .Open "SHOW DATABASES", cnn, adOpenStatic, adLockReadOnly But this is a workaround, not a fix.