我無法按字母搜索。像果醬一樣。我必須寫出像詹姆斯這樣的全名。有人可以幫我改變代碼,這樣我就可以用字母搜索。搜索代碼datasheed
這是我的代碼
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim Load As SearchFromTable = New SearchFromTable
With Me.DataGridView1
.DataSource = Load.GetMyData _
("Select *" _
+ " From tblInfo Where Fname='" & Trim(Me.txtSearch.Text) & "'" _
+ " or Lname='" & Trim(Me.txtSearch.Text) & "'" _
+ " or Department='" & Trim(Me.txtSearch.Text) & "'" _
+ " or Company='" & Trim(Me.txtSearch.Text) & "'")
End With
End Sub
在您要搜索的文本後面添加%。順便注射。 –
您應該使用'LIKE' ra比'=' – Jaxi