Linq dynamic query problem - operator 'OR' is incompatible with operand types 'Boolean' and 'String'


Diogo Martinho

I'm currently trying to define a dynamic query in Linq and I'm getting the following error:enter image description here

My query is as follows:

valuesList = valuesList.Where("(position=1 OR value LIKE '%3%')")

What am I doing wrong?

Ishida

try this -
you can't pass strings in linq statements

 valuesList = valuesList.Where(x=>x.position == 1 || x.value.Contains(3))

Related


Operand type is incompatible with operator

Noppadet i get error Operand type is incompatible with operator Click OK in the header when trying to compare two "real" data types. Can anyone help me with what problem? public void clicked() { real localAnnualUsage = itemSetup_DS.AnnualUsage();

Operand type is incompatible with operator

Noppadet i get error Operand type is incompatible with operator Click OK in the header when trying to compare two "real" data types. Can anyone help me with what problem? public void clicked() { real localAnnualUsage = itemSetup_DS.AnnualUsage();