views:

3971

answers:

2

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?

+8  A: 

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
If all you want is the details (instead of the whole User), you can do a "select user.Detail"
Bramha Ghosh
Yes - but I assumed that when the OP said "details" he meant "all fields of the table" rather than a specific field called "details".
Jon Skeet
I took the freedom to format the question to match Jon's answer.
David Schmitt
A: 

thank you jon Skeet

Please use Add Comment to respond to a specific answer, SO is not a Forum or a newsgroup
AnthonyWJones
@AnthonyWJones - not enough rep to add comments; you need 50
Marc Gravell