views:

674

answers:

1

I've a DataSet with 3 DataTables:

dtPerson

dtSalary

dtFriend

Every person has salaries, and every person has one friend.

I've added a column dcHisFriend into dtSalary and would like to display friend name of a person owning specified salary.

So dtPerson has a column NAME, dtSalary has column VALUE and dtFriend has a column NAME.

I've added column dcHisFriend and set Expression to this:

dtSalary.Add(dcHisFriend);

dcHisFriend.Expression = "Max(Parent.Child(Persons_Friend).NAME)";

But this obviously does not work.

Could you please tell me how to put into column dcHisFriend name of a friend of a person with a salary into salary table?

+1  A: 

I think, there is no way how to access any other row in "Expression" in DataColumn.

The only way, how to achieve similar behaviour is hook to DataColumnChanged event on DataTables where are source data and then set the computed value to the regular column (=column without expression).

TcKs