473,832 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3608
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*********@gm ail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.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
2018
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. Currently, I am allowing the parent to be edited by itself. In order to get to a child table, a user needs to select a specific parent table ID. I have set this up using panels, and putting a drop-down list in the first panel, with its contents...
8
3932
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 addition fields. I'm able to get the datagrid to be properly populate with only the child records relating to the specified parent by setting the ..DefaultView.RowFilter property. Currently, to properly add a new child record, I need to manually...
0
1402
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. Parenttable = Customers with some databound textboxes Childtable = Orders with some databound textboxes Parent-Child Datarelation on field CustomerId I.e. Customer FISSA doesn't yet have Orders. So when I navigate (code not
2
6044
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 100 102 3 101 103 4 102
5
3546
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 do the update the changed parentid in the child table fails to change. No error is given its just that the change is not written to the Database. When I step through the records for the child table the one I would expect to be changed has a row...
1
3523
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 - itemtran_id,bill_id,item_id,price I am using datagrid for Itemtran table. in case of new bill creation , I can't know new bill_id before updating data. As my itemtran table's field bill_id doesn't accept null value, I have to replace bill_id . Temporary, I
1
12644
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 DataMember-settings). My code is: DataSet ds = new DataSet();
1
3570
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 other combo box. I already know one way to make this work using two DataTables and a DataView, and handling the SelectionChangeCommitted event of the parent ComboBox so that it sets the .RowFilter of the DataView to which the child ComboBox is...
1
1265
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 Dim da2 As SqlDataAdapter Dim con As SqlConnection Dim ds As New DataSet con = New SqlConnection(StrCon)
0
10780
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10498
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10540
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9319
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.