- Messages
- 117
- Reaction score
- 0
- Points
- 26
dapat meron kang common fields sa dalawa or maski sampung tables
for example may table kang StudentFile, meron dun StudentID at ibang details gaya ng name, bday, etc
tapos meron kang table na StudentEnrollMent, nandun ang student id, at details ng babayran
common field yung StudentID so pwede mo makuha yung tuition details at names
INNER JOIN sa SQL ang gagamitin mo dyan
read all about it
sir eto po code ko pa check namn po salamat.
#Region "FillListView"
Sub FillListview()
LV.Items.Clear()
myqry = "SELECT AccResult.StudNo,Exercises.ID from AccResult INNER JOIN Exercises ON AccResult.StudNo = Exercises.StudNo ORDER BY AccResult.FirstName,AccResult.YrandSec Asc;"
mycmd = New OleDbCommand(myqry, con)
con.Open()
mydr = mycmd.ExecuteReader
While mydr.Read
With LV
.Items.Add(mydr("StudNo"))
With .Items(.Items.Count - 1).SubItems
.Add(mydr("CNumber"))
.Add(mydr("FirstName"))
.Add(mydr("LastName"))
.Add(mydr("YrandSec"))
.Add(mydr("Exer1"))
.Add(mydr("Exer2"))
.Add(mydr("Exer3"))
.Add(mydr("Exer4"))
.Add(mydr("Exer5"))
End With
End With
End While
con.Close()
End Sub
#End Region
AccResult is the name of my first table and Exercises is the second. my PK for AccResult is StudNo and for Exercises is ID. how can i join this two table to display in ListView.
[AccResult Table] StudNo (PK) CNumber FirstName LastName YrandSec
[Exercises Table] ID (PK) StudNo Exer1 Exer2 Exer3 Exer4 Exer5
Last edited: