HomeActive Query BuilderRelations/Joins When Adding Tables via code vs. via Drag & Drop

Relations/Joins When Adding Tables via code vs. via Drag & Drop


I hope this makes sense....

I have three tables (A, B, C) - I've manually defined relations between A-B and between B-C. Now I'm trying to do a query that involves tables A and C. For the query to work correctly, it would need to pull in table B and make the appropriate joins.

When I try to do this in code, table B is added, but no joins are made. After doing this in code, I can look at the AQB control and I see the 3 tables displayed, but without any joining lines. After this, I use the AQB control to delete table B and then drag and drop table B onto the form again - and now the control automatically draws the join-lines between my tables. If I run the query at this point, I get the results I want.

Do you have any idea what I'm doing wrong when I try to do this all in code?
Rob | email
July 23 2008, 02:10 PM
Nevermind, I think I just needed to use the .AddLink() method off the ActiveUnionSubquery.

I added code to do that and it seems to be working now.
Rob | email
1 hour, 56 mins since original post
Dear Rob,

An example of programmatic adding of relation between two objects could be found in the Query Modification Demo

Sergey
Sergey Smagin | email
1 week since original post
This topic is closed