Saturday, July 13, 2013

Read XML Data Into DataSet In Asp.Net C# VB.NET

using System.Data;
using System.IO;
protected void btnReadXmlFile_Click(object sender, EventArgs e)
    {
        string filePath = Server.MapPath("~/Employees.xml");
        DataSet dsData = new DataSet();
        //If you don't want to read through FileStream then comment below line
        FileStream fsReadSchema = new FileStream(filePath, FileMode.Open);
        dsData.ReadXml(fsReadSchema);
        fsReadSchema.Close();
        GridView1.DataSource = dsData;
        GridView1.DataBind();
    }

0 comments:

Post a Comment