How can I make this code Search ANY field under the textboxes? right now it will only return a result if all fields match exactly? Thanks in advance!
Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles Button1.Click
cmd = New SqlCommand
cmd.Connection = cn
cmd.CommandText = "Select * from [Case Managers] " & _
"where firstname like '%" & Me.txtfirstname.Text & "%' " &
"or " & _
"lastname like '%" & Me.txtlastname.Text & "%' " & _
"or " & _
"credentials like '%" & Me.txtCredentials.Text & "%'" & _
"or " & _
"active like '%" & Me.cboActive.Text & "%'"
dr = cmd.ExecuteReader
Me.ListView1.Items.Clear()
While dr.Read
With Me.ListView1
.Items.Add(dr(0))
With .Items(.Items.Count - 1).SubItems
.Add(dr(1))
.Add(dr(2))
.Add(dr(3))
.Add(If(dr(4) = 0, "No", "Yes"))
End With
End With
End While
dr.Close()
End Sub
End Class