473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Access nested child data within a dataset

Can someone tell me how to access the "nested child" data of a specific
parent from within a dataset? I read an XML file into a dataset with its
schema and want to access the child nested data. The one I access is
identified by a unique value within the parent data. In the below snippet,
I'll loop through the LanguageData64 entries and find the Code (e.g., 00).
From there are want to access the PartNumbers and return a reference to that
PartNumbers table to access its entries.

A snippet of the XML file is here.

<Languages64Bit>
<LanguageData64>
<Abbr>B2</Abbr>
<Code>B2</Code>
<MUI>false</MUI>
<Language>Global</Language>
<PartNumbers>
<PartNumber1>35-01</PartNumber1>
<PartNumber2>35-02</PartNumber2>
</PartNumbers>
<Description>a description</Description>
</LanguageData64>
<LanguageData64>
<Abbr>US</Abbr>
<Code>00</Code>
<MUI>false</MUI>
<Language>English</Language>
<PartNumbers>
<PartNumber1>33-01</PartNumber1>
<PartNumber2>33-02</PartNumber2>
</PartNumbers>
<Description>another description</Description>
</LanguageData64>
</Languages64Bit>

--
-----------
Thanks,
Steve
May 3 '06 #1
3 6021
Hi Steve,

To access child rows from your Xml file, you need to create schema for the
DataSet in order to let the DataSet get relation information. Here are the
steps:

1. Add the xml file to project.
2. Select Create Schema button to create the schema.
3. Add the schema file to your project.
4. When creating the DataSet, load schema with DataSet.ReadXmlSchema.
5. Load data with DataSet.ReadXml.
6. You can now get child rows with DataRow.GetChildRows method. Here is an
example.

DataRow[] dr =
ds.Tables["LanguageData64"].Rows[0].GetChildRows("LanguageData64_PartNumbers
");

HTH.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 4 '06 #2
This was exactly what I needed to get past the barrier I was against. Thank
you very much!!!!

--
-----------
Thanks,
Steve
"Kevin Yu [MSFT]" wrote:
Hi Steve,

To access child rows from your Xml file, you need to create schema for the
DataSet in order to let the DataSet get relation information. Here are the
steps:

1. Add the xml file to project.
2. Select Create Schema button to create the schema.
3. Add the schema file to your project.
4. When creating the DataSet, load schema with DataSet.ReadXmlSchema.
5. Load data with DataSet.ReadXml.
6. You can now get child rows with DataRow.GetChildRows method. Here is an
example.

DataRow[] dr =
ds.Tables["LanguageData64"].Rows[0].GetChildRows("LanguageData64_PartNumbers
");

HTH.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 4 '06 #3
You're welcome!

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
2
by: James Ankrom | last post by:
Why does this fail? Dim relResources As New Data.DataRelation("Application_Resources", ..Tables("User_Applications").Columns("Application_id"),...
9
by: Clint | last post by:
Hey all - Excuse the cross-post ... I'm not sure what the appropriate newsgroup would be for this question. I have a question that I'm not quite sure how to ask. For all I know, I have the...
0
by: Ed Allan | last post by:
http://ejaconsulting.com/nestedrepeater/NestedRepeater.txt >-----Original Message----- >Doh! The HTML has all been rendered . . . > >Right click on this link and select 'Save target as ..' >to...
5
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML...
2
by: mavrick_101 | last post by:
Hi, I have a nested repeater. For each row in the parent repeater there is a child repeater with several rows of data. The way I'm doing this is throught ItemDataBound Event. So for each Row...
4
by: JJ | last post by:
My question is basically about whether its best to do a small number database accesses and do most of the data organisation in sql stored procedures, or one larger fetch from the database and do...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
0
by: wadesharp | last post by:
I would like to write a query to return nested data. The data has a master, child relationshiop and teh child is linked to the master record through the 3 column (LinkedKey). The reason this is all...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.