K
Kevin
Hi All
this is going to be a lengthy questions do please bear
with me....
I have a database that has three tables - Employees,
ShiftHeader,ShiftDetails
Now the employees table holds the ShiftID for the
ShiftHeader table, to determine which shif t the employee
belongs to, As for the ShiftHeader table it has the
ShiftID, and a bunch of other information relating the
the Shift as a whole. Now for the ShiftDetails, this
holds detailed info about the specific ShiftID So in
other words my relationships look like this :
Employee ShiftHeader
ShiftDetails
ShiftID (Many-------1) ShiftID (1----Many) ShiftID
(Sorry for the disgusting diagrams!)
But my problem is the following:
I have a Datarow that I have declared inside a foreach
loop that cycles through all the employees. This Datarow
is set to retrieve the Parentrow(ShiftID from
ShiftHeader) eg
foreach(DataRow drEmp in Dataset.Tables["Employees"].rows)
{
DataRow drShiftHeader
drShiftHeader = drEmp.GetParentRow(EmpShiftHeadRel);
//do dome work with the drShiftHeader
}
Now that goes well and I can cycle through the
drShiftHeader columns and Debug.Write the data, but I
cannot seem to get the Child rows of the drShiftHeader
DataRow eg
foreach(Datarow drEmp in Dataset.Tables["Employees"].rows)
{
DataRow drShiftHeader
DataRow[] drShiftDetails
drShiftHeader = drEmp.GetParentRow(EmpShiftHeadRel);
//do dome work with the drShiftHeader
drShiftDetails = drShiftHeader.GetChildRows
(ShiftHeadertoShiftDetailsRel);
//drShiftDetails.Length = 0!
}
Can anyone direct me what to do in order for me to
retrieve the child rows of the parent row I have just
gotten? What am I doing wrong here?
Thanks for nay help - it is much appreciated
Kevin
this is going to be a lengthy questions do please bear
with me....
I have a database that has three tables - Employees,
ShiftHeader,ShiftDetails
Now the employees table holds the ShiftID for the
ShiftHeader table, to determine which shif t the employee
belongs to, As for the ShiftHeader table it has the
ShiftID, and a bunch of other information relating the
the Shift as a whole. Now for the ShiftDetails, this
holds detailed info about the specific ShiftID So in
other words my relationships look like this :
Employee ShiftHeader
ShiftDetails
ShiftID (Many-------1) ShiftID (1----Many) ShiftID
(Sorry for the disgusting diagrams!)
But my problem is the following:
I have a Datarow that I have declared inside a foreach
loop that cycles through all the employees. This Datarow
is set to retrieve the Parentrow(ShiftID from
ShiftHeader) eg
foreach(DataRow drEmp in Dataset.Tables["Employees"].rows)
{
DataRow drShiftHeader
drShiftHeader = drEmp.GetParentRow(EmpShiftHeadRel);
//do dome work with the drShiftHeader
}
Now that goes well and I can cycle through the
drShiftHeader columns and Debug.Write the data, but I
cannot seem to get the Child rows of the drShiftHeader
DataRow eg
foreach(Datarow drEmp in Dataset.Tables["Employees"].rows)
{
DataRow drShiftHeader
DataRow[] drShiftDetails
drShiftHeader = drEmp.GetParentRow(EmpShiftHeadRel);
//do dome work with the drShiftHeader
drShiftDetails = drShiftHeader.GetChildRows
(ShiftHeadertoShiftDetailsRel);
//drShiftDetails.Length = 0!
}
Can anyone direct me what to do in order for me to
retrieve the child rows of the parent row I have just
gotten? What am I doing wrong here?
Thanks for nay help - it is much appreciated
Kevin