-
Loading data from an XML string to a dataset
I just cannot find a code sample showing how to load data from an XML string
to a dataset! Everything out there has samples loading from a file but not
from a string. Does anyone has a sample loading from a string to a stream,
to a dataset???
Alternatively, when using the DataSet() property of an XmlDataDocument, one
must first load the Schema. Here again it is looking for a stream?
Help! this is driving me nuts.
-
Re: Loading data from an XML string to a dataset
G'day Thomas.
>I just cannot find a code sample showing how to load data from an XML string
>to a dataset!
Easily done (Note that you will have to supply the XML string yourself ie
the GetXML() function) :
Dim s As String = GetXML()
Dim ds As System.Data.DataSet = New System.Data.DataSet()
Dim StringReader As System.IO.StringReader = New System.IO.StringReader(s)
ds.ReadXml(StringReader)
Or, in shorter form:
Dim ds As System.Data.DataSet = New System.Data.DataSet()
ds.ReadXml(New System.IO.StringReader(GetXML()))
HTH,
Cheers,
Paul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks