I'm using the code below to make a filter in my DataGridView
, but when I do the filter using like in a field of type int
, I get the following error:
Can not perform 'Like' operation on System.Int32 and System.String.
Follow the code:
Private Sub txtProcura_TextChanged(sender As Object, e As EventArgs) Handles txtProcura.TextChanged
If dt.Rows.Count = 0 Then Exit Sub
Try
Select Case cboxFiltro.SelectedItem
Case Is = "Pedidos"
dv = New DataView(dt, "Pedido like '%" & txtProcura.Text & "%'", "Pedido asc", DataViewRowState.OriginalRows)
Case Is = "Chave"
dv = New DataView(dt, "chave like '%" & txtProcura.Text & "%'", "Pedido asc", DataViewRowState.OriginalRows)
End Select
dgvPedidosSAT.DataSource = dv
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Would anyone have a solution?