Article ID: 258904 - Last Review: April 22, 2003 - Revision: 2.1

FIX: FetchProgress Event Returns Incorrect Data with MDAC 2.1

This article was previously published under Q258904

On This Page

Expand all | Collapse all

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:
http://msdn.microsoft.com/dataaccess (http://msdn.microsoft.com/dataaccess)

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  (http://support.microsoft.com/kb/224332/EN-US/ ) PRB: ADO Recordset Opened with adAsyncFetch May Seem Synchronous

APPLIES TO
  • Microsoft ActiveX Data Objects 2.1
  • Microsoft ActiveX Data Objects 2.1 Service Pack 1
  • Microsoft ActiveX Data Objects 2.1 Service Pack 2
Keywords: 
kbbug kbfix KB258904
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
 

Article Translations