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..

Recommended Answers

All 2 Replies

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

tnx alot jim!.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.