S
Shibu
Hi,
What is the best way to convert DataSet containing parent child relations
into a single DataTable (Flatten)
For eg:-
DataSet will contain Tables as follows
Tbl_Parent( Parent_Id, Parent_Name)
Tbl_Child( Child_Id, Child_Name, Parent_Id)
Tbl_ChildOfChild(ChildOfChild_Id, ChildOfChild.Name, ChildOfChild.Child_Id)
Sample data with respect to the above columns
Tbl_Parent
( Parent_Id, Parent_Name)
1 "A"
----------------------------------------------------------------------------
----------------
Tbl_Child
(Child_Id, Child_Name, Parent_Id)
1 "a" 1
2 "b" 1
3 "c" 1
----------------------------------------------------------------------------
----------------
Tbl_ChildOfChild
(ChildOfChild_Id, ChildOfChild.Name, ChildOfChild.Child_Id)
1 "aa" 1
2 "bb" 1
1 "aa" 2
2 "bb" 2
3 "cc" 2
1 "aa" 3
----------------------------------------------------------------------------
----------------
Tbl_ChildOfChild
1 "aa"
2 "bb"
I would like to get the data into a single DataTable
as follows;
1 "A" 1 "a" 1 "aa"
1 "A" 1 "a" 2 "bb"
1 "A" 2 "b" 1 "aa"
1 "A" 2 "b" 2 "bb"
1 "A" 2 "b" 3 "cc"
1 "A" 3 "c" 1 "aa"
Any suggestions??
Shibu
What is the best way to convert DataSet containing parent child relations
into a single DataTable (Flatten)
For eg:-
DataSet will contain Tables as follows
Tbl_Parent( Parent_Id, Parent_Name)
Tbl_Child( Child_Id, Child_Name, Parent_Id)
Tbl_ChildOfChild(ChildOfChild_Id, ChildOfChild.Name, ChildOfChild.Child_Id)
Sample data with respect to the above columns
Tbl_Parent
( Parent_Id, Parent_Name)
1 "A"
----------------------------------------------------------------------------
----------------
Tbl_Child
(Child_Id, Child_Name, Parent_Id)
1 "a" 1
2 "b" 1
3 "c" 1
----------------------------------------------------------------------------
----------------
Tbl_ChildOfChild
(ChildOfChild_Id, ChildOfChild.Name, ChildOfChild.Child_Id)
1 "aa" 1
2 "bb" 1
1 "aa" 2
2 "bb" 2
3 "cc" 2
1 "aa" 3
----------------------------------------------------------------------------
----------------
Tbl_ChildOfChild
1 "aa"
2 "bb"
I would like to get the data into a single DataTable
as follows;
1 "A" 1 "a" 1 "aa"
1 "A" 1 "a" 2 "bb"
1 "A" 2 "b" 1 "aa"
1 "A" 2 "b" 2 "bb"
1 "A" 2 "b" 3 "cc"
1 "A" 3 "c" 1 "aa"
Any suggestions??
Shibu