Cannot perform 'Like' operation on System.String and System.Int32

Hi. I’m using DT.SELECT and the LIKE operator - code as follows:

db_in.Select(“VALUE LIKE 1 OR VALUE LIKE 2 OR VALUE LIKE 3”).CopyToDataTable

And I get the Cannot perform ‘Like’ operation on System.String and System.Int32. error message. Any suggestions?

Hello Mickey,

You’re likely going to need to cast either one of them as the other type to make them comparable.

Here’s a link to give you an idea of how to do that:

I get what you’re trying to do, but it doesn’t really bring me any closer to a solution. I’m too green to make use of that link.

have you tried using“VALUE LIKE ‘%1%’ or VALUE LIKE ‘%2%’ or VALUE LIKE ‘%3%’”)
Hope this will work for you!

what are you trying to accomplish? LIKE operator can only be used with “text” not on numbers…


It’s due to some syntax error. It should be like this.

        db_in.Select(“VALUE LIKE '1%' OR VALUE LIKE '2%' OR VALUE LIKE '3%'”).CopyToDataTable
1 Like

My code is working with numbers, but ok.

Hello @mickeymack

When I have to compare (equal comparison) value of a column with multiple values, I use below… {"1","2","3"}.Contains(rw("Column1").ToString)

or when I have to check if a column contains multiple values I use below… {"1","2","3"}.ToList.Any(Function(val) rw("Column1").ToString.Contains(val))).ToArray.CopyToDataTable