XML Dataset with ambiguous rows

  • Thread starter Thread starter babybob
  • Start date Start date
B

babybob

Hello

Can someone help an ado.net newbie.

I have and xmldoc something like this


<response>
<command ref="command1">
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row>
</command>
<command ref="command2">
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row>
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row>
</command>
</response>


When I read this into a dataset its seems to merge all the <row>
's into one table. I was expecting them to be in two tables one for
each command. How do I achieve this, do i use a schema?

Thanks for any advice
Brian
 
Because of the relationships defined by your xml the row elments are placed
in a single datatable you can then use the datatable created for the
commands element to navigate to its children via the GetChildRows() method.

Here is a good read on the subject:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechar
t/html/vbtchnavigatingmultiplerelatedtablesinadonetdataset.asp

Hope this helps.
Brian Parlier

babybob said:
Hello

Can someone help an ado.net newbie.

I have and xmldoc something like this


<response>
<command ref="command1">
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row>
</command>
<command ref="command2">
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row>
<row>
<rowcol1>somecontent</rowcol1>
<rowcol2>somecontent</rowcol2>
</row>
</command>
</response>


When I read this into a dataset its seems to merge all the <row>
's into one table. I was expecting them to be in two tables one for
each command. How do I achieve this, do i use a schema?

Thanks for any advice
Brian
 
Back
Top