private string ConvertTableToXml(DataTable table)
{
StringWriter sw = new StringWriter();
table.WriteXml(sw, XmlWriteMode.IgnoreSchema);
return sw.ToString();
}
and if you want to sort your data table before convert it to xml , here is the code snippets
myDatatable.DefaultView.Sort = "MaxPrice DESC";
string mystr = ConvertTableToXml(myDatatable.DefaultView.ToTable());
enjoy
Yaniv
No comments:
Post a Comment