By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

Can a child table be automatically filled in a DataSet with a DataRelation?

P: n/a
I have a dataset that contains a parent table and a child table. A
DataRelation exists between the two. I was under the impression from
reading the VS docs that when I filled the parent table, the child
table would be automatically filled with the child records. When I fill
the parent, I limit the table to only a single record, so that all the
records in the child table will belong to this parent. But when the
Fill method is executed with the parent, the child table is not filled.
All the coding examples I've seen use the GetChildRows method to
retrieve the child records. I find this rather absurd when I've defined
a DataRelation that explicitly links the parent to the child. If the
GetChildRows is not called, does that mean it is possible to have data
stored in the child table unrelated to data stored in the parent? If
so, what is the sense of having a DataRelation? Furthermore, the
GetChildRows returns the records in an array. This does not fill the
child table in the DataSet. If I understand correctly, to fill the
table, only the Fill command can be used.

Johann Blake

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

You need to understand that a dataset has no relation to the SQL being
used, it's intended to be used as an independend structure, you can put in
the same dataset tables that comes from different dbms, XML files, etc. you
could then establish relationship among these tables.
GetChildRows works on the data ALREADY present in the dataset, it does not
load any data from the datastore.

I have never read that when you fill the parent table the child is also
filled, this is not true.
It's your responsability to do so, you have to do a Fill both in the
parents as well as in the child table.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Johann Blake" <jo*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I have a dataset that contains a parent table and a child table. A
DataRelation exists between the two. I was under the impression from
reading the VS docs that when I filled the parent table, the child
table would be automatically filled with the child records. When I fill
the parent, I limit the table to only a single record, so that all the
records in the child table will belong to this parent. But when the
Fill method is executed with the parent, the child table is not filled.
All the coding examples I've seen use the GetChildRows method to
retrieve the child records. I find this rather absurd when I've defined
a DataRelation that explicitly links the parent to the child. If the
GetChildRows is not called, does that mean it is possible to have data
stored in the child table unrelated to data stored in the parent? If
so, what is the sense of having a DataRelation? Furthermore, the
GetChildRows returns the records in an array. This does not fill the
child table in the DataSet. If I understand correctly, to fill the
table, only the Fill command can be used.

Johann Blake

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.