AnuLakshmi M

AnuLakshmi M

  • NA
  • 12
  • 3.4k

Datatable to XML in C#

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