Live Chat Icon For mobile
Live Chat Icon

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

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

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

Please submit your question and answer.