I am having issues with filtering with the Like operand. If the data type of the column in my datagrid is a string it works perfectly but if it is a dateandtime or integer it will not work...gives generic EvaluateException referring to the datacolumn not being able to be evaluated. I understand that the Like statement is used on strings, booleans, and binary values. But there should be away for me to convert the data. Does it need to be converted in the stored procedure when the datagridview is loaded or can I do it in the
vb code?
Here is my code:
Select Case cbSearch.SelectedIndex
Case 0
Me.PalletBindingSource.Filter = "PalletID like'" & txtSearch.Text & "%" & "'"
If dgPallet.RowCount > 1 Then
Exit Sub
Else
subBind()
End If
Case 1
Me.PalletBindingSource.Filter = "ItemNum Like'" & txtSearch.Text & "%" & "'"
If dgPallet.RowCount > 1 Then
Exit Sub
Else
subBind()
End If
Case 2
Me.PalletBindingSource.Filter = "EntryDt Like'" & txtSearch.Text & "%" & "'"
If dgPallet.RowCount > 1 Then
Exit Sub
Else
subBind()
End If
End Select
Case 1 works but Case 0 and 2 give me the error.
I have tried converting both txtSearch.Text & PalletID to strings but still errors out. Any ideas?
Thank you,
John Williams