hi all:'(
i am a newbie want to know how to get values from two tables in database. I have three tables one is the student information and the other table is the subject and grades .Both tables have id number which may join them together But what i need to do is, i have a listview that i named lvMasterlist which displays the list of the students names and lvGrades which display the subject and the grades of the student from first grading till fourth grading and what i want is that everytime i click one of names in lvmasterlist it will display the data in the lvGrades. Is it possible. i have tried some codes below which it did'nt output the one i desired:
can anyone help me with this problem...anyway Im using navicat mySql as a database...
Private Sub lvMasterList_click()
lblName = lvMasterList.SelectedItem
LoadSubjects
LoadGrades
LoadLevel
LoadGender
LoadSection
End Sub
Sub LoadSubjects()
'-----------------------------------------------------------------------------------------------------
lvGrades.ListItems.Clear
connect
rs.Open "tblSubject ", con, 3, 3
Do Until rs.EOF
Set listitem1 = lvGrades.ListItems.Add()
listitem1.Text = rs("SubjTitle")
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
con.Close: Set con = Nothing
End Sub
Sub LoadGrades()
'-----------------------------------------------------------------------------------------------------
lvGrades.ListItems.Clear
connect
rs.Open "tblsubject join tblenroll ", con, 3, 3
Do Until rs.EOF
Set listitem1 = lvGrades.ListItems.Add()
listitem1.Text = rs("SubjTitle")
With lvGrades.ListItems.Add(, , rs("FirstGrading"))
.SubItems(1) = (rs("SecondGrading"))
.SubItems(2) = (rs("ThirdGrading"))
.SubItems(3) = (rs("FourthGrading"))
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
con.Close: Set con = Nothing
End Sub
Sub LoadLevel()
'-----------------------------------------------------------------------------------------------------
connect
rs.Open "tbllevel ", con, 3, 3
Do Until rs.EOF
Set listitem1 = lvGrades.ListItems.Add()
lblLevel2 = rs("LevelName")
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Sub LoadGender()
'-----------------------------------------------------------------------------------------------------
connect
rs.Open "tblstudent ", con, 3, 3
Do Until rs.EOF
'Set listitem1 = lvGr.ListItems.Add()
lblGender = rs("StudGender")
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
con.Close: Set con = Nothing
End Sub
Sub LoadSection()
'-----------------------------------------------------------------------------------------------------
connect
rs.Open "tblsection ", con, 3, 3
Do Until rs.EOF
'Set listitem1 = lvGr.ListItems.Add()
lblName = lvMasterList.SelectedItem
lblSection = rs("SectionName")
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
con.Close: Set con = Nothing
End Sub
:(