I have written a LINQ query with 'or' condition and 'and' but its not working well.
from x in db.fotoes.Where(x => x.uid == NewsId &&
x.ukat == 'fukat1' || x.ukat == 'fukat2')
i cant figure out why its not working,can anybody help me to fix this problem?
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'))
Group your conditions by adding parentheses:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With