Showing posts with label Dataset. Show all posts
Showing posts with label Dataset. Show all posts

Feb 20, 2008

Converting Valid XML String To Dataset

Imports System.Text
Imports System.Xml
Imports System.Data
Imports System.IO

Dim sb As New System.Text.StringBuilder
sb.Append("")
sb.Append("")
sb.Append("" & "Ethan Liew" & "")
sb.Append("" & "info@ethanliew.com" & "")
sb.Append("
")
sb.Append("
")

' Covert to string reader then to xmltextreader
Dim reader As New XmlTextReader(New StringReader(sb.ToString))
Dim ds As New DataSet
ds.ReadXml(reader)

' Return dataset
Return ds

1. First you need to use StringReader to read the string.
2. Convert it to XmlTextReader
3. Create a new dataset to