1
I’m using the code below to make a filter on my DataGridView
, but when I filter using the like in a field of the kind int
, I get the following error:
Cannot perform 'Like' operation on System.Int32 and System.String.
Follows 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
Someone would have a solution?
dt
is aDataTable
?– mateusalxd
That’s right, Matthew!
– Felipe S
Not necessarily, I can vary, but I’m using this because I did a query and it worked perfectly, I just didn’t understand why it didn’t work with Dataview. What is your suggestion ?
– Felipe S