this thing is getting into my nerves and i really don't know what to do.. i tried a lot of variations in my code and even sql statement but still nothing happens.. i really need to do thing messed up project of mine and put all my efforts here.. but i really can't understand why my combo box isn't showing the names of the candidates w/ that designated position.. please help me, heres my current code:
constr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " & Application.StartupPath & _
"\SSC_Automation.mdb; Persist Security Info = False"
cn.ConnectionString = constr
cmd = New OleDbCommand("SELECT Lname,Fname,MI FROM tblCandidates WHERE CandPosition='President'" _
& " and PartylistName='" & cbPartylist.Text & "'", cn)
cn.Open()
If cbPartylist.Text = (dr("PartylistName").ToString()) Then
dr = cmd.ExecuteReader
While dr.Read()
cbPres.Text = (dr("Lname") & ", " & dr("Fname") & " " & dr("MI").ToString())
End While
End If
cn.Close()
---
i am working on a university student council voting system and what i wanted to do is when the voter selected the radio button name "Vote by Party list" automatically the names of all the partylist that are entered in the databse will be listed in the combo box and all the candidates on that Party list will be shown on the individual combo boxes made for each position..