简体   繁体   English

Linq动态查询问题-运算符“ OR”与操作数类型“ Boolean”和“ String”不兼容

[英]Linq Dynamic Query Issue - Operator 'OR' incompatible with operand types 'Boolean' and 'String'

I am currently trying to define a dynamic query in Linq but I am receiving the following error: 我目前正在尝试在Linq中定义动态查询,但收到以下错误: 在此处输入图片说明

My Query is the following: 我的查询如下:

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

What am I doing wrong? 我究竟做错了什么?

Try this- 尝试这个-
You cannot pass string inside a linq statement 您不能在linq语句中传递字符串

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检测到类型不兼容的二元运算符。 找到运算符类型“Equal”的操作数类型“Edm.Guid”和“Edm.String” - A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal' 检测到具有不兼容类型的二元运算符。找到操作数类型edm.string和edm.guid用于种类相等 - A binary operator with incompatible types was detected. Found operand types edm.string and edm.guid for kind equal Linq查询-动态数据类型 - Linq query - dynamic data types 运算符&#39;==&#39;与使用DynamicExpression.ParseLambda的操作数类型&#39;Guid&#39;和&#39;Guid&#39;不兼容<T, bool> - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> 其他字段和布尔值的 linq 查询中的动态值 - Dynamic values in linq query by other field and boolean value 使用布尔类型的动态ListItem列构造一个linq查询 - Constructing a linq query with dynamic ListItem columns that are type boolean +带有空操作数的字符串连接运算符 - + string concat operator with a null operand 动态linq表达式查询,出现问题 - dynamic linq expression to query, getting issue 布尔LINQ问题 - Boolean LINQ Issue 动态linq和运算符重载 - Dynamic linq and operator overloads
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM