Creating Data Relationships between Tables

bizjosh

Member
Joined
Mar 16, 2005
Messages
23
Programming Experience
Beginner
I got the relationships setup. however the second listbox
doesnt display what i wanted.

dataAdapt = New OleDbDataAdapter("SELECT * from Table1", oledbCon)
dataAdapt.Fill(Dataset, "Table1")
dataAdapt.SelectCommand = New OleDbCommand("SELECT * from Table2", oledbCon)
dataAdapt.Fill(Dataset, "Table2")
dataAdapt.SelectCommand = New OleDbCommand("SELECT * from Table3", oledbCon)
dataAdapt.Fill(Dataset, "Table3")
dataAdapt.SelectCommand = New OleDbCommand("SELECT * from Table4", oledbCon)
dataAdapt.Fill(Dataset, "Table4")

'Relations added'

lstBox1.DataSource = dataset.Tables("Table1")
lstBox1.DisplayMember = "ID" <- displays ok!

lstBox2.DataSource = dataset.Tables("Table4")
lstBox2.DisplayMember = "eca_points" <- doesnt display

Table1 fields are: ID, student_number
Table2 fields are: ID, firstname, class, eca
Table3 fields are: class, teacher
Table4 fields are: eca, eca_points

Question:
After creating relationships between Table1&2 Table2&3 Table2&4,
when an ID(from Table1) is selected in listbox1, how do i get it
to display eca_points(from Table4) in Listbox2 as there is no direct
relationship between Table 1 and 4?

How do i work this out?
 
Top Bottom