473,385 Members | 1,409 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,385 software developers and data experts.

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

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
1 3565
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Neo Geshel | last post by:
Greetings. I have a serious problem. I have multiple sets of tables, several of which are chained more than two tables deep. That is, I have a parent, a child, and a great-grandchild table. ...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
0
by: Coco | last post by:
Hi, who knows how to update the 'child' textboxes in a datarelated situation if the child records "doesn't yet exitsts/are still empty"? The problem can be explained with the Northwind database....
2
by: RJN | last post by:
Hi I need help in writing a recursive function. My table structure is as below. InstanceId LevelId ParentId 100 1 null 101 2 ...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
1
by: Hardik Shah | last post by:
Hi, I have created a form for sales bill information. I am using two tables, its salient filds are as below. 1) Bill - Fields - bill_id,customer_id,tdate 2) Itemtran - Fields -...
1
by: Jan Lorenz | last post by:
Hello, my problem is to show a datarelation between two tables (parent/child) in a datagridview. It doesn't works. There is always shown only 1 table in the grid (in relation of...
1
by: Bob Johnson | last post by:
..NET 3.5, Windows Forms app: My objective is to display parent/child data in two ComboBox controls, such that when a parent item is selected in one combo box, associated child items appear in the...
1
by: Sep410 | last post by:
Private Sub frmSearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sql1 As String Dim sql2 As String Dim da1 As SqlDataAdapter ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.