can someone please help me with this problem i'm a beginner in programming.
there is two comboboxes which is S.Y.(school year) and Sem(semester) and i want to use these two combo boxes to have more specific data in the listview below.
Private Sub Search_Record() Dim conn As New OleDbConnection Dim cmd As New OleDbCommand Dim da As New OleDbDataAdapter Dim dt As New DataTable Dim sSQL As String = String.Empty Try conn = New OleDbConnection(Get_Constring) conn.Open() cmd.Connection = conn cmd.CommandType = CommandType.Text sSQL = "SELECT edp_number, LastName + ', ' + FirstName as name, course as course, Address as address, syear as syear, Sem as sem FROM tblStudent" If Me.cboSearchBy.Text = "1st" Then sSQL = sSQL & " where Sem like '1st" & Me.txtSearch.Text & "%'" Else sSQL = sSQL & " where Sem like '2nd" & Me.txtSearch.Text & "%'" End If cmd.CommandText = sSQL da.SelectCommand = cmd da.Fill(dt) Me.dtgResult.DataSource = dt If dt.Rows.Count = 0 Then MsgBox("No record found!") End If Catch ex As Exception MsgBox(ErrorToString) Finally conn.Close() End Try End Sub
this code only uses the sem combobox which is cboSearchby so now all i need to know is how to make combobox S.Y to function too and if also to use that texbox to search for firstname and lastname.