C# DataSet.Relations: How to use DataSet Relations?

I have 3 tables and I have made relations to each of them.

let say: table 1 has: aID, bID, cID, someText and someNumber

table 2 has: bID, txtValueTable2, someText

table 3 has: cID, txtValueTable3, someText

some code:

ds.Relations.Add("BrandNameStr", ds.Tables[1].Columns["bID"], ds.Tables[0].Columns["bID"]);
            ds.Relations.Add("IngredientStr", ds.Tables[2].Columns["cID"], ds.Tables[0].Columns["cID"]);

Now I want to use the columns off all 3 tables to make 1 dataset, but I don't know how?

The dataset must have the following columns: aID, txtValueTable2, txtValueTable3, someText and someNumber

Can someone help me?

Answers


Here there is a good example.

In few words you have to use DataTabel.GetChildRows() method.

Here are working example


Hi you need to change by this:

ds.Relations.Add("BrandNameStr",ds.Tables[0].Columns["bID"], ds.Tables[1].Columns["bID"]);


Need Your Help

iOS Objective-C Memory sufficient removal of elements (ARCs impact on child elements)

ios objective-c uiview memory-leaks automatic-ref-counting

When removing a UIView using removeFromSuperview, will ARC correctly handle the dealloc of the UIView's child elements?

Custom scrollbar for listview

android listview scrollbar

I have a task to create a custom scrollbar for list view and to my knowledge the way you can customize your scrollbar is very limited on android. Is it possible to achieve exact same result like th...