Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: First Row Is Not Saved if ADO Recordset Is Bound to Any Control and Persisted to XML


View products that this article applies to.

This article was previously published under Q287083

↑ Back to the top


Symptoms

If an ActiveX Data Object (ADO) recordset is bound to any bound control and is then persisted to XML, the first row is not saved.

↑ Back to the top


Resolution

There are two possible workarounds:
  • Use server-side cursors.
  • Save the recordset clone, which saves all of the records.

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Open a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. On the Project menu, click to select References. From the list of available references, select Microsoft ActiveX Data Objects 2.5 Library.
  3. Place a CommandButton and a TextBox control on Form1.
  4. Copy and paste the following code:
    Option Explicit
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    Private Sub Form_Load()
    Set cn = New ADODB.Connection
    cn.Open "Provider=SQLOLEDB.Connection;Data source=<SERVERNAME>;user id=sa;password=;Initial Catalog=Northwind;"
    cn.CursorLocation = adUseClient
    
    Set rs = New ADODB.Recordset
    rs.Open "Select Employeeid,Lastname,firstname,Birthdate from employees", cn, adOpenStatic, adLockReadOnly
    
    Set Text1.DataSource = rs
    Text1.DataField = "LastName"
    End Sub
    Private Sub Command1_Click()
    rs.Save "c:\temp\test.xml", adPersistXML
    
    End Sub
    					
  5. Run the program, click Command1, and then stop the project.
  6. Open test.xml, and note that the first record of the Employees table is not saved.

↑ Back to the top


Keywords: KB287083, kbpending, kbmsxmlnosweep, kbdatabinding, kbbug

↑ Back to the top

Article Info
Article ID : 287083
Revision : 3
Created on : 5/8/2003
Published on : 5/8/2003
Exists online : False
Views : 343