[英]What is the proper AND operator in SQLite where statement
Using & or && in the where-statement? 在where语句中使用&或&&? It seems it is not working.
看来没有用。
can anyone help me with the Lambda expression on Sqlite query statement. 谁能帮我在Sqlite查询语句上使用Lambda表达式。
Thanks. 谢谢。
var existingItemUoM = db2.Table().Where(c => c.UoM == ItemNo & c.ItemNo == CodeforUoM).SingleOrDefault()
Since you seem to be using linq, the correct operator for AND
is 由于您似乎正在使用linq,因此
AND
的正确运算符是
&&
A good reference here are the 101 LINQ Samples . 101 LINQ样本是一个很好的参考。
The single &
is a non-short-circuit and-operator. 单
&
是非短路和运算符。 This means even if the first condition evaluates to true, the second condition will be checked (which isn't the case when using &&
, the short-circuit and-operator). 这意味着即使第一个条件评估为true,也将检查第二个条件(使用
&&
短路和运算符时不是这种情况)。
Furthermore, in a real SQLite statement the correct expression for the boolean and-operator would be and
, refer to the expressions of SQLite . 此外,在真实的SQLite语句中,布尔值and-operator的正确表达式将是
and
, and
引用SQLite的表达式 。
Correct operator for AND is &&, check with following where class AND的正确运算符是&&,请按照以下where类进行检查
var existingItemUoM = db2.Table().Where( (c => c.UoM) && (c.UoM == ItemNo) && (c.ItemNo == CodeforUoM) ).SingleOrDefault() var existingItemUoM = db2.Table()。Where( (c => c.UoM)&&(c.UoM == ItemNo)&&(c.ItemNo == CodeforUoM) ).SingleOrDefault()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.