Reputation: 281
id | IsEnquiry |
=================
1 true
2 false
3 false
4 true
How can I get the count of id where IsEnquiry=true by using a Linq Query
Pls Help me to write the query.
Thanks, Bharath
Upvotes: 18
Views: 70158
Reputation: 1953
Try this :
int count = (from row in db.Table
where row.IsEnquiry == true
select row.id).Count();
Upvotes: -1
Reputation: 1157
Try this code:
int count = (from tableObj in TableName
where tableObj
.Website == "http://mywebsite.com"
select tableObj
.Website).Count()
Upvotes: 0
Reputation: 4972
int count = (from row in db.Table
where row.IsEnquiry == true
select row).Count();
Upvotes: 42