4

I have tried one where clause in Linq to get details about Users those who are Active and AllowLogin is also true.

So how can I compare the table values (both are boolean values) with true or false?

David Schmitt
  • 58,259
  • 26
  • 121
  • 165

2 Answers2

14

Just use something like:

var query = from user in context.Users
            where user.Active && user.AllowLogin
            select user;

Alternatively, you can write the same query without a query expression:

var query = context.Users.Where(user => user.Active && user.AllowLogin);
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
0
var qry = (from en in Contaxt.tblStatDefinitions
                   where en.Name == "Sunandan"
                   select en.id).Single();