Wednesday, July 5, 2017

search

============= search
  Dim isSearch As Boolean = False
        If txtModel.Text <> "" And txtYear.Text <> "" Then
            strQ = "SELECT * FROM tbCar where Model like '%" & txtModel.Text & "%' and Year like '" & txtYear.Text & "' ORDER BY [Model]"
            isSearch = True

        ElseIf txtYear.Text <> "" And txtModel.Text = "" Then
            strQ = "SELECT * FROM tbCar where Year like '" & txtYear.Text & "' ORDER BY [Year]"
            isSearch = True
        ElseIf txtYear.Text = "" And txtModel.Text <> "" Then
            strQ = "SELECT * FROM tbCar where Model like '%" & txtModel.Text & "%' ORDER BY [Model]"
            isSearch = True
        Else
            strQ = "SELECT * FROM tbCar    ORDER BY [Model]"
            isSearch = True
        End If
        If isSearch = True Then
            load_data(strQ)       
        End If

====================

No comments:

Post a Comment