简体   繁体   中英

What is the proper AND operator in SQLite where statement

Using & or && in the where-statement? It seems it is not working.

can anyone help me with the Lambda expression on Sqlite query statement.

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

&&

A good reference here are the 101 LINQ Samples .
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).

Furthermore, in a real SQLite statement the correct expression for the boolean and-operator would be and , refer to the expressions of SQLite .

Correct operator for AND is &&, check with following where class

var existingItemUoM = db2.Table().Where( (c => c.UoM) && (c.UoM == ItemNo) && (c.ItemNo == CodeforUoM) ).SingleOrDefault()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM