J
Joe Bonavita
I'm using a SqlReader to read results from a query and insert them into a
DataTable. The DataTable is from a DataSet which contains an Xml that was
read in using ReadXml().
My problem is, only 1 row gets written correctly. The others don't have any
attributes and are not in the proper hierarchy in the Xml yet they're all
created from the same loop.
while (sqlReader.Read() )
{
DataRow dr = dtProducts.NewRow();
dr.ItemArray[dr.Table.Columns.IndexOf("Col1")] =
sqlReader.GetString(indexPT);
...
...
// set more rows
dtProducts.Rows.Add(dr);
}
ds.WriteXml(@"X:\temp\Test.xml");
DataTable. The DataTable is from a DataSet which contains an Xml that was
read in using ReadXml().
My problem is, only 1 row gets written correctly. The others don't have any
attributes and are not in the proper hierarchy in the Xml yet they're all
created from the same loop.
while (sqlReader.Read() )
{
DataRow dr = dtProducts.NewRow();
dr.ItemArray[dr.Table.Columns.IndexOf("Col1")] =
sqlReader.GetString(indexPT);
...
...
// set more rows
dtProducts.Rows.Add(dr);
}
ds.WriteXml(@"X:\temp\Test.xml");