How to read data from the XML file using FileStream and display it in a DataGrid

Platform: ASP.NET| Category: XML

Use namespace System.IO

VB.NET


dim ds as new DataSet()
dim fs as FileStream = new FileStream (Server.MapPath ('products.xml'),FileMode.Open , FileAccess.Read )
ds.ReadXml (fs)
DataGrid1.DataSource = ds
DataGrid1.DataBind ()

C#


DataSet ds= new DataSet ();
FileStream fs = new FileStream (Server.MapPath ('products.xml'),FileMode.Open , FileAccess.Read );
ds.ReadXml (fs);
DataGrid1.DataSource = ds;
DataGrid1.DataBind ();

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.