Creating a master-details relationship between 3 tables

M

mkidd

Hi,

I'm new at vb .net and I have an issue that must be a common one, but I
haven't found an example of it yet.

I want to create parent-child relationships for 3 tables
(grandparent-parent-child?). I'm trying to create a contact management
app. My 3 tables are Company, Contacts and Results. All 3 tables will
be bound to datagrids-- when you click on a company (first datagrid)
you should see the list of contacts for that company in the second
datagrid; when you click on one of those contacts you should see a list
of results from calls made on that contact in the 3rd datagrid.

I can get the relation with the first 2 tables to work fine-- click on
a company, see that company's list of contacts. But I can't get the
filtered "Contacts" to work with its child table.

Hope someone can help me with this; thanks in advance.

Michael Kidd
(e-mail address removed)
 
A

Arsalan

Use nested join statement, group the last two join statement in a
parenthesis, then again join with the first table.

If you can show what you used in your SQL statement it would be helpful
 
M

mkidd

Arsalan said:
Use nested join statement, group the last two join statement in a
parenthesis, then again join with the first table.

If you can show what you used in your SQL statement it would be helpful
 
M

mkidd

The only SQL I used was a select statement to fill a dataadapter for
each table. I used datarelation code to join the tables. Like I said,
this works fine for 1 parent-child relationship, but I can't get it to
work with the third table. I figured I was doing somethign wrong
rebinding the datagrid.

I'll look into using SQL for a solution. Thanks!
 
R

Richard

You must be having two relations. Something like RLCompany2Contacts and
RLContacts2Results

Contact Grid
GrdContacts.DataSource=ds.Tables("Company")
GrdContacts.DataMember="RLCompany2Contacts"

Result Grid
GrdResult.DataSource=ds.Tables("Company")
GrdResult.DataMember="RLCompany2Contacts.RLContacts2Results"

This will work for you.
RC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top