You don't have to make a connection as such, you can just load the XML directly into a DataSet, i.e.
And if you have the XML in a file, just pass the file name to the ReadXML method instead, i.e.VB Code:
Dim ds As New DataSet Dim xml As String xml = "<?xml version='1.0' encoding='utf-8' ?><ArtWork><Art><ID>1</ID><title>Blue World</title><Artist>Steve Jackson</Artist><Path>c:\artwork\blu01.jpg</Path><Style>Abstract</Style></Art><Art><ID>2</ID><title>The Body</title><Artist>George Willard</Artist><Path>c:\artworkbo01.jpg</Path><Style>Modern</Style></Art><Art><ID>3</ID><title>Flashlight</title><Artist>Bob Miller</Artist><Path>c:\artqorkfl01.jpg</Path><Style>Modern</Style></Art></ArtWork>" ds.ReadXml(New IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes(xml))) DataGrid1.DataSource = ds DataGrid1.DataMember = "Art"
VB Code:
Dim ds As New DataSet ds.ReadXml("c:\data.xml") DataGrid1.DataSource = ds DataGrid1.DataMember = "Art"




Reply With Quote