tags:

views:

44

answers:

1

Hello, C# 2005. I have a dataset with 3 tables, and I would like to get the xml for just one of these tables. Any idea?

TY

A: 

Here's a snippet from http://dotnetslackers.com/articles/ado_net/MappingDataSetToXMLAndBackwards.aspx. I'd suggest you read the whole article.

DataTable.WriteXML is the method you need for just one table.

Something like:

private void SingleTableToXml(DataSet ds)
{
    ds.Tables["myTable"].WriteXML(Server.MapPath("mytable.xml"),XmlWriteMode.IgnoreSchema);
}
David Neale
This will force me to write it to the Hard disc, which i'm trying to avoid.
working perfect. TY.
There are numerous overloads for WriteXML so you don't have to write to disc. http://msdn.microsoft.com/en-us/library/system.data.datatable.writexml.aspx
David Neale