G
Guest
Hi,
I have two DataView objects sharing the same DataTable. I want to merge these two. Ideally the DataView class would have a Merge(DataView dv) method, but it doesn't.
Does anyone know how to do this?
Here is what Im trying to accomplish. Say I am using the Northwind database and I want to display 2 DataGrids, one representing the Customer table and one for OrderDetails table. Everytime I select a customer in the Customers table I would like to show all the order details in the Orders table for all the orders for that customer. So say the DataRowView representing the customer is customerDataRowView, then I will get all the children in the Orders table for that customer by
ordersDataView = customerDataRowView.CreateChildView(CustomerToOrdersDataRelation);
Then I want to say:
orderDetailsDataView = new DataView();
foreach(DataRowView drv in ordersDataView.Rows)
{
DataView dv = drv.CreateChildView(OrdersToOrderDetailsDataRelation);
orderDetailsDataView.Merge(dv);
}
Thanks in advance for all your help.
Nima
I have two DataView objects sharing the same DataTable. I want to merge these two. Ideally the DataView class would have a Merge(DataView dv) method, but it doesn't.
Does anyone know how to do this?
Here is what Im trying to accomplish. Say I am using the Northwind database and I want to display 2 DataGrids, one representing the Customer table and one for OrderDetails table. Everytime I select a customer in the Customers table I would like to show all the order details in the Orders table for all the orders for that customer. So say the DataRowView representing the customer is customerDataRowView, then I will get all the children in the Orders table for that customer by
ordersDataView = customerDataRowView.CreateChildView(CustomerToOrdersDataRelation);
Then I want to say:
orderDetailsDataView = new DataView();
foreach(DataRowView drv in ordersDataView.Rows)
{
DataView dv = drv.CreateChildView(OrdersToOrderDetailsDataRelation);
orderDetailsDataView.Merge(dv);
}
Thanks in advance for all your help.
Nima