BUG: DataReport Does Not Show First Record with Server-Side Forward-Only Cursor (300387)



The information in this article applies to:

  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0

This article was previously published under Q300387

SYMPTOMS

When a Visual Basic DataReport object is bound to an ActiveX Data Objects (ADO) Recordset object whose CursorLocation property is set to adUseServer and whose CursorType property is set to adOpenForwardOnly, the DataReport does not display the first record in the recordset, even though the record is present.

RESOLUTION

To resolve this problem, specify a client-side ADO cursor ("CursorLocation = adUseClient"), or specify a server-side CursorType other than the adOpenForwardOnly enumeration.

STATUS

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

MORE INFORMATION

Because a server-side, forward-only cursor is the ADO default and not the default for a DataEnvironmentCommand object, this problem is more likely to occur when the DataReport is bound to an ADO recordset that has been opened in code. However, you can use the DataEnvironment to easily reproduce this problem.

Steps to Reproduce Behavior

  1. Create a new Data project in Visual Basic.
  2. Open the DataEnvironment designer, and configure the default connection to connect to an available Microsoft SQL Server and its Northwind database.
  3. Add a command under the connection. On the General tab, select the CustOrdersOrders stored procedure.
  4. On the Parameters tab, type ALFKI as the value for the CustomerID input parameter.
  5. On the Advanced tab, set the CursorLocation to 2 - Use server-side cursors and the CursorType to 0 - Forward-only. Close the Properties dialog box.
  6. Click to expand the field list under the Command object. Open the DataReport designer, and drag the OrderID field from the field list under the Command object to the detail section of the DataReport.
  7. Specify DataEnvironment1 as the DataSource for the DataReport, and Command1 as its DataMember.
  8. Open the project's Form, "frmDataEnv", and add a command button. In the command button's Click event procedure, add the following code:
    DataReport1.Show
    					
  9. Run the project, and click the command button to display the DataReport. Notice that the first displayed order number is 10692 and that the first order for customer ALFKI, number 10643, is missing.
  10. End the project, and return to the Advanced tab of the DataEnvironment Command Properties dialog box. Change the CursorLocation to 3 - Use client-side cursors. This also changes the CursorType to 3 - Static.
  11. Run the project again, and click the command button to display the DataReport. Notice that the first displayed order number is now 10643, which is the first order for customer ALFKI.

Modification Type:MajorLast Reviewed:6/13/2001
Keywords:kbbug kbDatabase kbDSupport kbReportWriter KB300387