标签:blog 使用 ar div new log ad table
//将DataTable转换成xml字符串: public string ConvertDataTableToXml(DataTable dt) { MemoryStream stream = null; XmlTextWriter writer = null; try { stream = new MemoryStream(); writer = new XmlTextWriter(stream, System.Text.Encoding.Unicode); dt.WriteXml(writer); int count = (int)stream.Length; byte[] arr = new byte[count]; stream.Seek(0, SeekOrigin.Begin); stream.Read(arr, 0, count); System.Text.Encoding ucode = System.Text.Encoding.Unicode; //若使用utf-8,遇中文会发生乱码 return ucode.GetString(arr).Trim(); } catch { return String.Empty; } }
将DataTable转换成xml字符串,布布扣,bubuko.com
标签:blog 使用 ar div new log ad table
原文地址:http://www.cnblogs.com/shenchao/p/3907084.html