//Read and Write from dataset to XML
using System.Xml.Serialization;
using System.IO;
using System.Data;
DataSet ds = new DataSet();
string qry = "Select distinct UserID, UName from dbo.tblUsers";
ds = AdminBl.Selectrecord("sp_selectglobal", qry); //Executing stored procedure
//writing xml file
StreamWriter objxml = new StreamWriter(Server.MapPath("~/XMLFile.xml"), false);
// Apply the WriteXml method to write an XML document
ds.WriteXml(objxml);
objxml.Close();
//Read from xml file and Fill the Gridview
DataSet dset = new DataSet();
dset .ReadXml(Server.MapPath("~/XMLFile.xml"));
GridView1.DataSource = dset;
GridView1.DataBind();
No comments:
Post a Comment