0

How would i connect different tables with each other in vbnet2008 which ive connected by the database wizard ? im suffering from this problem for 4 days and i havent fixed it ..and o search over the net but they give me the solution by hard coded that are related with importing sql or oledb, i dont have any idea to the code , and i need to stick with this method cause my other member wouldn understand too if i do it alone...
and also i want to connect this table for the search purpose. I filter it by Name which is in my personal_informationtbl so the rest of the table must show the related information about the Name that ive searched.

so meaning if i just search by name it shows related information from the records not just from the personal_informationtbl but fill the other tables with the related information.,


sorry for the grammar im suck at this..

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by zeroflee09
0

You relate two (or more) tables by having one or more columns in common. For example, a customer database would typically have a customer information table similar to

CUST_INFO
   Cust_ID
   Last_Name
   First_Name
   Address

where Cust_ID is a unique number generated by the app or the datbase system. Any other table that relates data to a customer would also contain a Cust_ID field. For example, an order table might look like

ORDER_INFO
    Order_No
    Cust_ID
    Order_Date
    Shipping_Date

If you had a query that required information from both tables you would use a join (implicit ot explicit) which refers to the requested fields and the field that relates the two tables. An explicit join looks like

select * from CUST_INFO inner join ORDER_INFO 
           on CUST_INFO.Cust_ID = ORDER_INFO.Cust_ID

An implicit join looks like

select * from  CUST_INFO,ORDER_INFO
         where CUST_INFO.Cust_ID = ORDER_INFO.Cust_ID

Using aliases can shorten the typing a little by

select * from  CUST_INFO As CI,ORDER_INFO As OI
         where CI.Cust_ID = OI.Cust_ID

A very good tutorial on joining SQL tables can be found here

Edited by Reverend Jim: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.