Datagrid Parent/Child Relationship

B

B-Dog

I'm trying to comprehend the database features in VB and after tons of
reading I'm not sure how do relationships. I want to display a parent
column and the respective child columns on one line of a datagrid. For
example, Employee table and Employee Details table I'd like to display the
employee name and their details on one line of a datagrid, without having to
have the "hyperlink" to the employee details like I'd seen. Can anyone give
me a website that may have an example of something like this. I've search
around but can't find anything. Thanks
 
D

Doug Bell

Hi B-Dog,
The rease for relationships is to model the real life structure of the
system you want to manage or analyse.

With your example, the reason for having Employee Details in a separate
table to Employees is only valid if you want to store multiple sets of
Employee Details for each Employee. If not then you should have only one
Table. If you do then you can not represent the data on one line, if there
is more than one detail record. You can create a recordset that includes the
Employee fields and the Employee Detail fields:

"Select Employee.Field1, Employee.Field2, EmployeeDetails.Field1,
EmployeeDetails.Field2, etc....
FROM Employee LEFT JOIN EmployeeDetails ON Employee.PrimaryKeyField =
EmployeeDetails.ForiegnKeyField"

Where Field1 etc are Field Names and PrimaryKeyField is the name of the
Employee field that is the Primary Key and ForiegnKeyField is the name of
the EmployeeDetails field that is the Foriegn Key.
 
B

B-Dog

Oh I understand relationships, I do a lot of database work but I can't
figure out how to implement them in VB. They work but not easily like in
access. I'm just a little confused on the implementation in VB.
 

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