G
Guest
I'm looking for some guidance on filling multiple DataSet DataTables based on
a "complex" query.
Given 3 tables: Parent, ChildOne, and ChildTwo, where ChildOne.ParentID
and ChildTwo.ParentID relate to Parent.ParentID.
I would like to populate the Parent table based on a complex query across
several source database tables. Then, I would like to populate the ChildOne
and ChildTwo tables with only those rows that relate to Parent rows returned
by the main query.
Is there a mechanism in the DataSet to tell it to "Fill ChildOne based on a
list of Parent.ParentID values"?
One SQL concept is as follows:
SELECT * FROM ChildOne WHERE ChildOne.ParentID IN ( @Parent_Id_List );
Another post indicated that the DataAdapter Parameter cannot be used for IN
and CONTAINS. I've found that ParentID IN (1) works, but ParentID IN
(1,2,3) fails because "1,2,3" is interpreted as a String and ParentID is a
Decimal.
There has to be a fundamentally simple approach to populating multiple
DataTables based on nested relationships. Please help!
- CWP
a "complex" query.
Given 3 tables: Parent, ChildOne, and ChildTwo, where ChildOne.ParentID
and ChildTwo.ParentID relate to Parent.ParentID.
I would like to populate the Parent table based on a complex query across
several source database tables. Then, I would like to populate the ChildOne
and ChildTwo tables with only those rows that relate to Parent rows returned
by the main query.
Is there a mechanism in the DataSet to tell it to "Fill ChildOne based on a
list of Parent.ParentID values"?
One SQL concept is as follows:
SELECT * FROM ChildOne WHERE ChildOne.ParentID IN ( @Parent_Id_List );
Another post indicated that the DataAdapter Parameter cannot be used for IN
and CONTAINS. I've found that ParentID IN (1) works, but ParentID IN
(1,2,3) fails because "1,2,3" is interpreted as a String and ParentID is a
Decimal.
There has to be a fundamentally simple approach to populating multiple
DataTables based on nested relationships. Please help!
- CWP