CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    3

    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

  2. #2
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    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);

  3. #3
    Join Date
    Nov 2006
    Posts
    99

    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
  •  





Click Here to Expand Forum to Full Width

Featured