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();

posted @ 2016-07-23 20:15  Zohar  阅读(3706)  评论(0编辑  收藏  举报