Microsoft KB Archive/287083

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

Article ID: 287083

Article Last Modified on 5/8/2003

-

APPLIES TO


 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6
 * Microsoft Data Access Components 2.7

-



This article was previously published under Q287083



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.



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



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



Steps to Reproduce Behavior
 Open a new Standard EXE project in Visual Basic. Form1 is created by default. On the Project menu, click to select References. From the list of available references, select Microsoft ActiveX Data Objects 2.5 Library. Place a CommandButton and a TextBox control on Form1.  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 &quot;Provider=SQLOLEDB.Connection;Data source=;user id=sa;password=;Initial Catalog=Northwind;&quot; cn.CursorLocation = adUseClient

Set rs = New ADODB.Recordset rs.Open &quot;Select Employeeid,Lastname,firstname,Birthdate from employees&quot;, cn, adOpenStatic, adLockReadOnly

Set Text1.DataSource = rs Text1.DataField = &quot;LastName&quot; End Sub Private Sub Command1_Click rs.Save &quot;c:\temp\test.xml&quot;, adPersistXML

End Sub  Run the program, click Command1, and then stop the project.</li> Open test.xml, and note that the first record of the Employees table is not saved.</li></ol>

Keywords: kbbug kbdatabinding kbpending kbmsxmlnosweep KB287083

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.