Is there a way i can create an XML from datatable without using
-
A
StringWriter:System.IO.StringWriter writer = new System.IO.StringWriter(); yourDataTable.WriteXml(writer, XmlWriteMode.WriteSchema, true);Doesn’t work well for me as it gives descendants as column headers. I want first row as descendants.
-
Iterating over DataColumns and DataRows.
I was reading about LINQ-to-DataTable and LINQ-to-XML .
Can LINQ query help me?
Here’s an example of using the
XmlDocumentclass to generate XMLThe linq to xml library
XDocumentfollows a similar model. you should look at the documentation and make use of it.