2007-07-02

Read xml content to DataSet.

This sample show, How to read xml's content to dataset.

Use System.Xml and System.IO namespace.

Imports System.Xml

Imports System.IO



Sample XML




Sample Code

Dim ds As New DataSet
' use filestream class to read xml content.
Dim streamRead As New System.IO.FileStream("C\test.xml", _
System.IO.FileMode.Open)


'Dataset can read content from FileStream.
ds.ReadXml(streamRead)

' Bind data to your control.
DataGridView1.DataSource = ds.Tables(0)


' Close FileStream object

streamRead.Close()


You will see you data in your data control.


3 comments:

Thanks for your comment.