using System.Xml.Linq;
private string GetXmlByDt(DataTable dt)
{
XDocument Employee = new XDocument(new XDeclaration("1.0", "utf-8", "true"),
new XElement("MB1", from cust in dt.AsEnumerable()
select new XElement("A11", cust["No"]
)));
return Employee.ToString();
}
執行後結果如下