Microsoft KB Archive/258904

= FIX: FetchProgress Event Returns Incorrect Data with MDAC 2.1 =

Article ID: 258904

Article Last Modified on 4/22/2003

-

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

-



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:

http://msdn.microsoft.com/dataaccess



Steps to Reproduce Behavior
 Create a new Standard EXE in Visual Basic. Form1 is created by default. On the Project Menu, click to select References, and then select ActiveX Data Objects Library 2.1.  Add the following code to Form1: Option Explicit

Const strConn = &quot;Northwind&quot; Const strSQL = &quot;SELECT * FROM Employees&quot;

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(&quot;Initial Fetch Size&quot;) = 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 &quot;Progress: &quot; & Progress & &quot; MaxProgress: &quot; & MaxProgress End Sub  Change the Constant strConn so that it has a valid connection string to a Northwind database. Run the code, and note that &quot;Progress: 0 MaxProgress: 1&quot; appears in the Immediate window.</ol>

<div class="references_section">