无法表演'喜欢' System.Int32和System.String上的操作。用MySQL VB.Net

时间:2014-05-31 09:07:32

标签: mysql vb.net

我不知道为什么会出现此错误。它说转换字符串,但我认为它已经是字符串格式。这是什么解决方案?

Private Sub txtSearch_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSearch.TextChanged
    Dim DV As New DataView(dbDataSet)
    DV.RowFilter = String.Format("emp_no Like '%{0}%'", txtSearch.Text)
    DataGridView1.DataSource = DV
End Sub

1 个答案:

答案 0 :(得分:0)

试试这个

Private Sub txtSearch_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSearch.TextChanged
    Dim DV As New DataView(dbDataSet)
    DV.RowFilter = String.Format("Convert(emp_no,'System.String') Like '%{0}%'", txtSearch.Text)
    DataGridView1.DataSource = DV
End Sub