XML string to dataset

I'm trying to read an XML string into a dataset.
This is not from a url from an in memory xml e.g.
todayxml = XElement.Load(strURL)
then trying
ds.ReadXml(todayxml)

But it gives an error expecting url.
Thought I had this working before so don't know what I've changed.
Any help thanks.
LVL 58
GaryAsked:
Who is Participating?
 
Rose BabuConnect With a Mentor Senior Team ManagerCommented:
Hi,

try the below code to read XML string to dasaset

Dim stream As StringReader = Nothing
Dim reader As XmlTextReader = Nothing

Dim xmlDS As New DataSet()
stream = New StringReader(todayxml)

reader = New XmlTextReader(stream)
xmlDS.ReadXml(reader)

Open in new window

Hope this will help you a lot.
0
 
GaryAuthor Commented:
Yep just found it myself. Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.