任何机构都说我们如何将数据表转换为XML格式。 我尝试了下面的一个但是没有保存或导出数据
XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection<DLReports.FCBuySellDetail>));
using (StreamWriter wr = new StreamWriter("customers.xml"))
{
xs.Serialize(wr, DetailReportFCBuySell1);
}
答案 0 :(得分:5)
DataTable dtSample = new DataTable();
dtSample.WriteXml(fileName); //Pass the path of the XML file.