Hi Greg,
The underlying data of a DataSet is stored as XML.
Below is a code that creates a DataSet, a DataTable, DataColumns and then
add some sample data.
protected void Button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable("MyDataTable");
dt.Columns.Add(new DataColumn("ID", typeof(Int32)));
dt.Columns.Add(new DataColumn("Name", typeof(string)));
ds.Tables.Add(dt);
dt.Rows.Add(new object[] { 1, "Bruno 1" }); /* the values passed
here are in the order of creation of the datacolumns, "ID" first, "Name"
second */
dt.Rows.Add(new object[] { 2, "Bruno 2" });
dt.Rows.Add(new object[] { 3, "Bruno 3" });
Response.Write("<pre>" + Server.HtmlEncode(ds.GetXml()) + "</pre>");
}
The GetXml method returns the underlying xml... this is to show you how the
xml structure is, and below is a code that you would use to "bind" this xml
to a GridView control.
protected void Button2_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
/* fills the dataset with the xml from db */
ds.ReadXml(command.ExecuteXmlReader());
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
I don't know how the scructure of your xml is, but if you can fit it in a
DataSet it would be a good way to do what you want, try to add more
DataTables to the DataSet and see the output xml. Check also the
GetXmlSchema and ReadXmlSchema methods of the DataSet.
More info on DataSet here
http://msdn2.microsoft.com/en-us/library/system.data.dataset.aspx
Bruno