Hi all,

I just managed to make "quasi-join" in the dataset (for displaying it in
Windows Forms datagrid):

Dataset1.Relations.Add("MyRelation",Table1.Id,Table2.T1Id)
Dataset1.Tables!Table2.Columns.Add("ParentValue", _
GetType(String),"Parent(MyRelation).Value")

Now I have a new problem: the parent table has another Parent, and I
need to display one of its fields (Table3.Value2)
Table3.Id <--> Table1.T3Id, Table1.Id <--> Table2.T1Id

I've tried this:

Dataset1.Relations.Add("MyRelation2",Table1.T3Id,Table3.Id)
Dataset1.Tables!Table3.Columns.Add("ParentValue2", _
GetType(String),"Parent(MyRelation).Parent(MyRelation2).Value2")

But it causes nothing but an exception.

Any ideas?
Michal.

RE: Datacolumn.Expression and double Parent by rami

rami
Tue Sep 28 06:35:23 CDT 2004

Hello,

If you need dataset to fill a datagrid, then you don't need a second
relation.
You can change the select statement of the parent table to include its
parent as well. And then write the relation with the child table as you
did.
You also need to customize the column styles of the parent table. So each
row in the datagrid will have the values of the parent tables, and could be
expanded to include the parent-child relation and show the child values.
Below is a link to show you how to customize the column styles of the table:
http://www.xmlfox.com/CSsamples.htm
http://www.codeproject.com/csharp/PracticalGuideDataGrids4.asp#_Toc56951048
Hope this helps you answer your question.
If you still have problems, don't hesitate to post/reply back.

Regards,
Rami Saad
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC




Re: Datacolumn.Expression and double Parent by MichalR

MichalR
Wed Sep 29 05:58:28 CDT 2004

Rami Saad wrote:

> Hello,
>
> If you need dataset to fill a datagrid, then you don't need a second
> relation.
> You can change the select statement of the parent table to include its
> parent as well. And then write the relation with the child table as you
> did.
> You also need to customize the column styles of the parent table. So each
> row in the datagrid will have the values of the parent tables, and could be
> expanded to include the parent-child relation and show the child values.
> Below is a link to show you how to customize the column styles of the table:
> http://www.xmlfox.com/CSsamples.htm
> http://www.codeproject.com/csharp/PracticalGuideDataGrids4.asp#_Toc56951048
> Hope this helps you answer your question.
> If you still have problems, don't hesitate to post/reply back.
>
> Regards,
> Rami Saad
> MEA Developer Support Center
> ITworx on behalf of Microsoft EMEA GTSC
>
>
>
>
Hi Rami,

Great thanks for your answer. I already used custom grid columns, but I
missed that they can be used in such case. (And that's why I used this
dirty solution based on expression columns and "Parent" function ).

kind regards,
Michal