PC Review


Reply
Thread Tools Rate Thread

Creating a master-details relationship between 3 tables

 
 
mkidd
Guest
Posts: n/a
 
      23rd Feb 2005
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 Removed)

 
Reply With Quote
 
 
 
 
Arsalan
Guest
Posts: n/a
 
      24th Feb 2005
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




"mkidd" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 Removed)
>



 
Reply With Quote
 
mkidd
Guest
Posts: n/a
 
      24th Feb 2005

Arsalan wrote:
> 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
>
>
>
>
> "mkidd" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 Removed)
> >


 
Reply With Quote
 
mkidd
Guest
Posts: n/a
 
      24th Feb 2005
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!


Arsalan wrote:
> 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
>
>
>
>
>


 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      25th Feb 2005
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








"mkidd" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 Removed)
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting/Creating a relationship between two tables -----> Help Pl FatMan Microsoft Access VBA Modules 0 20th May 2010 03:51 PM
code for creating a relationship between all tables in db Boulder_girl Microsoft Access VBA Modules 4 1st May 2009 06:50 PM
SQL Server 2005: Creating a relationship between two tables weird0 Microsoft C# .NET 1 17th Feb 2007 02:43 PM
creating/defining relationship between two tables =?Utf-8?B?R2l6?= Microsoft Access Getting Started 2 18th Apr 2005 09:24 PM
Creating a Form bounded to three tables with one-to-one relationship Rony Boter via AccessMonster.com Microsoft Access Forms 1 29th Dec 2004 02:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:18 AM.