Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2004

Tip: Looking for answers? Try searching our database.

Multiple DataRelations and DataGrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Örjan Leringe - 10 Oct 2004 11:07 GMT
I want to accomplish a DataRelation not only between Parent and Child but
also to a Grandparent.

I thought that would be possible by establishing a Datarelation between
GrandParent and Parent and another one between Parent and Child. Here is part
of the code:

// Fill the dataSet1 with the three tabels Grand, Parent and Child, and then:

DataColumn ColumnGrandIdA;
DataColumn ColumnParentIdA;
DataColumn ColumnParentIdB;
DataColumn ColumnChildIdB;

DataRelation RelationGrandParent;
DataRelation RelationParentChild;

ColumnGrandId = dataSet1.Tables["Grand"].Columns["IdA"];
ColumnParentIdA = dataSet1.Tables["Parent"].Columns["IdA"];
ColumnParentIdB = dataSet1.Tables["Parent"].Columns["IdB"];
ColumnChildIdB = dataSet1.Tables["Child"].Columns["IdB"];
RelationGrandParent = new DataRelation("RelationGrandParent",
ColumnGrandIdA, ColumnParentIdA);
RelationParentChild = new DataRelation("RelationParentChild",
ColumnParentIdB, ColumnChildIdB);
dataSet1.Relations.Add(RelationGrandParent );
dataSet1.Relations.Add(RelationParentChild );
dataGrid1.SetDataBinding(dataSet1, "Grand");
dataGrid2.SetDataBinding(dataSet1, "Grand.RelationGrandParent");
dataGrid3.SetDataBinding(dataSet1, "Parent.RelationParentChild");

Now only the dataGrid2 binding works. If I comment out the line
dataGrid2.SetDataBinding the dataGrid3 binding works.

How do I make the two bindings work simultaneously?

Örjan Leringe
Örjan Leringe - 13 Oct 2004 17:31 GMT
This is to clarify better what I think is not working as it should: When I
navigate in the first grid(Grand) the second grid displays the parents in the
second grid. The childs to the parents are there if I expand the rows in the
second grid. BUT: I want the children to turn up automatically iin the third
grid also!

How can I do this? I have had no problem doing this in Borland JBuilder
using their very similar DataExpress class libriaries in Java.

Örjan

> I want to accomplish a DataRelation not only between Parent and Child but
> also to a Grandparent.
[quoted text clipped - 33 lines]
>
> Örjan Leringe

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.