Linq query 'and' 'or' operators

Group your conditions by adding parentheses:

from x in db.fotoes.Where(x => (x.uid == NewsId) && 
                         (x.ukat == 'fukat1' || x.ukat == 'fukat2'))

Just try like this, you need to use parentheses to group your conditions:

from x in db.fotoes.Where(x => x.uid == NewsId && 
(x.ukat == 'fukat1' || x.ukat == 'fukat2'))

from x in db.fotoes.Where(x => x.uid == NewsId && (
x.ukat == 'fukat1' || x.ukat == 'fukat2'))

Is it what you're trying to do? You can group a set of conditions by having them inside parenthesis.

Tags:

C#

.Net

Linq