1
Reply

Datatable to XML in C#

AnuLakshmi M

AnuLakshmi M

Sep 10 2014 9:57 AM
629
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)