|
-
March 7th, 2007, 09:24 AM
#1
Loading XML formatted string into DataSet
Hi all,
i have a problem loading a XML formated string into a DataSet. Actually i can not find a way to do that except maybe writing a string into a file and then reading from it and populating the dataset, but that can be resource consumption.
String is:
MSG><ROW><NAME>xxxx</NAME><SURENAME>xxxx</SURENAME></ROW>
<ROW><NAME>yyyyy</NAME><SURENAME>yyyyyy</SURENAME></ROW></MSG>
Any help? Thanks in advance.
Regards
Igor
-
March 7th, 2007, 10:53 AM
#2
Re: Loading XML formatted string into DataSet
Load the string into a stream and feed it to the DataSet
Code:
DataSet ds = new DataSet();
StringReader sr = new StringReader(@"<MSG><ROW><NAME>xxxx</NAME><SURENAME>xxxx</SURENAME></ROW><ROW><NAME>yyyyy</NAME><SURENAME>yyyyyy</SURENAME></ROW></MSG>");
ds.ReadXml(sr);
-
March 7th, 2007, 08:58 PM
#3
Re: Loading XML formatted string into DataSet
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
|
Click Here to Expand Forum to Full Width
|