FIX: FetchProgress Event Returns Incorrect Data with MDAC 2.1 (258904)



The information in this article applies to:

  • ActiveX Data Objects (ADO) 2.1
  • ActiveX Data Objects (ADO) 2.1 SP1
  • ActiveX Data Objects (ADO) 2.1 SP2

This article was previously published under Q258904

SYMPTOMS

The FetchProgress event of an ADO recordset returns Progress and MaxProgress values. These variables indicate the current number of records that are fetched and the maximum number that are expected to be fetched. With ADO 2.1, these values are always returned as 0 and 1, respectively.

RESOLUTION

Upgrade to ADO version 2.1 Service Pack 2 (SP2) or later.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in ActiveX Data Objects version 2.1 SP1 or later. You can download the latest version of ADO from the following Microsoft Web site:

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Standard EXE in Visual Basic. Form1 is created by default.
  2. On the Project Menu, click to select References, and then select ActiveX Data Objects Library 2.1.
  3. Add the following code to Form1:
       Option Explicit
    
       Const strConn = "Northwind"
       Const strSQL = "SELECT * FROM Employees"
    
       Dim WithEvents rs As ADODB.Recordset
    
       Private Sub Form_Load()
          Dim cn As ADODB.Connection
          Set cn = New ADODB.Connection
          cn.Open strConn
       
          Set rs = New ADODB.Recordset
          With rs
             Set .ActiveConnection = cn
             .CursorLocation = adUseClient
             .Properties("Initial Fetch Size") = 1
             .Open strSQL, cn, , , adAsyncFetch
          End With
       End Sub
    
       Private Sub rs_FetchProgress(ByVal Progress As Long, _
                                    ByVal MaxProgress As Long, _
                                    adStatus As ADODB.EventStatusEnum,  _
                                    ByVal pRecordset As ADODB.Recordset)
          Debug.Print "Progress: " & Progress & "  MaxProgress: " & MaxProgress
       End Sub
    					
  4. Change the Constant strConn so that it has a valid connection string to a Northwind database.
  5. Run the code, and note that "Progress: 0 MaxProgress: 1" appears in the Immediate window.

REFERENCES

224332 PRB: ADO Recordset Opened with adAsyncFetch May Seem Synchronous


Modification Type:MinorLast Reviewed:4/22/2003
Keywords:kbbug kbfix KB258904