Convert XML to DataSet with rows

Posted by lidermin on Stack Overflow See other posts from Stack Overflow or by lidermin
Published on 2010-04-13T16:26:11Z Indexed on 2010/04/13 16:33 UTC
Read the original article Hit count: 324

Filed under:
|
|

Hi, I have an xml file like this:

<result>
  <customer>
     <id>1</id>
     <name>A</name>
  </customer>
  <customer>
     <id>2</id>
     <name>B</name>
  </customer>
</result>

So I need that data filled on a DataSet, here is my code:

 var reader = new StringReader(xmldoc.InnerXml);
 dsDatos.ReadXml(reader);

The problem is that it's filling the dataset with two Tables each one with a single row. But I need a single Table with the two rows.

What am I doing wrong?

PD: I'm using C# and I don't want to iterate through the XML file, I want to use the ReadXml method.

Thanks for your time.

© Stack Overflow or respective owner

Related posts about dataset

Related posts about c#