Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataSet and writeXML issue

Status
Not open for further replies.

ryebread

Programmer
Aug 13, 2001
29
0
0
US
Hello all... really could use your expert advice.

I have datatable in which i insert a record at the first row position (dt.insertAt(foo,0);). When viewed in the debugger the table has the row in the correct position, row[0].

Then I add the table into a dataset then set a datarelation that sets my table as a child table.

Later I create an xml file from the dataset(ds.writeXML(filename);). When I view the xml text, the rows I had inserted are in a different order. Why is this? How can maintain my original order?


Thanks!

Ryan
 
From the DOC:
"The location specified by InsertAt is reflected by the order of rows in the DataRowCollection only. If more than one row is returned in a DataRow array, the inserted row may not be returned in the location specified by InsertAt. For example, the Rows property returns the row in the specified insert position. Select and GetChildRows may not. When you write the contents of the DataRowCollection as XML (for example, WriteXml), the rows are written according to the order specified by the DataRowCollection.

If the value specified for the pos parameter is greater than the number of rows in the collection, the new row is added to the end.";
-obislavu-

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top