1
Answer

Datatable to XML in C#

AnuLakshmi M

AnuLakshmi M

10y
648
1
DataSet dts = new DataSet();
dts.Tables.Add(dt);
TextWriter tw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(tw);
dts.WriteXml(xtw, XmlWriteMode.IgnoreSchema);
stXML = tw.ToString(); //string XML Contains the XML Content
xtw.Close();
tw.Dispose();
Answers (1)