Click here to Skip to main content
15,920,383 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Every Buddy

i Use This Code For Filtering Data :

If fil1.TextLength > 0 Then
               ShenasnameBindingSource.Filter = String.Format("ID_sabt Like '" & fil1.Text) & "*' "
               ShenasnameBindingSource.Filter = String.Empty
           End If

This Code Is Ok For "ID_sabt" Type = Text .
But Not Working For Number Type .Error Msg = Cannot perform 'Like' operation on System.Int32 and System.String.

What Do i Do ?

You should use Cast/Convert first to convert your field to string value.
"Convert(varchar, ID_Int) like '" & fil1.Text) & "*'"[^]
Share this answer
You should use the integer comparators in the expression such as greater than (>), less than(<), greater than or equal to(>=) etc. Something like this:-

String.Format("ID_sabt >= {0}", fil1.Text);

Hope this helps
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900