Question display related data?

rekhtar

Member
Joined
Dec 24, 2008
Messages
9
Programming Experience
Beginner
Hi

I have a DataBase that contains 3 tables (Contacts, Telephones, Cats)

In my Form I have CombobBox to make quick search

this combobox filled with (ContactName) from (Contacts Table)

I want to display Contact details from 3 tables in textboxes that exist in my Form when I choose his name from combobox

The relation between Contacts and Telephones Tables is ( Contacts.CID = Telephones.CID), when Contacts.CID is P.K
and between Contacts and Cats tables is ( Cats.CatID = Contacts.CatID), when Cats.CatID is P.K

How can I do that ?!!

I use VB.NET 2005

thanks in advance
 
There really is very little code because, whether you use the Data Source Wizard or not, you still use a DataSet containing at least two DataTables with DataRelations between them.

Master/Detail (Parent/Child) Data-binding

In your case you'll have one parent table and two child tables with the child tables each bound to different controls.
 
Write query to join all these three tables & then by using command & data reader put releted data to textbox.
Now that I read the original post more carefully I agree that a single query to join all three tables is the best idea. You might consider getting all the data in one go though, and populating a DataTable that you can bind to the controls, as long as there isn't too much data.
 

Latest posts

Back
Top