C#中DataTable转换为string

DataTable dt = new DataTable();
DataSet ds = new DataSet();
ds.Tables.Add(dt);
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Xml.XmlTextWriter xw = new System.Xml.XmlTextWriter(sw);
ds.WriteXml(xm)
string s = sw.ToString();

原文地址:https://www.cnblogs.com/zzhua/p/5699435.html