Wednesday, June 9, 2010

Reading/Writing XML

To Read Data from the XML file

DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("XML\\XMLFile.xml")); //Path of XML file
GridView1.DataSource = ds;
GridView1.DataBind();

And to Write back the XML Date
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("XML\\XMLFile.xml"));
ds.WriteXml("XMLFile1.xml");

I am just creating the dataset from the existing file

No comments:

Post a Comment