(from d in _db.tbl_Issues
where d.IssueText == txt_Issue.Text && d.Deleted == false
select d).Any();
Hi StudentRik,
ANY methods which returns a boolean value to determine whether all the elements of a sequence satisfy a condition. Please take a look at following snippet.
bool ifAny = (from d in _db.tbl_Issues
where d.IssueText == txt_Issue.Text && d.Deleted == false
select d).Any();
if (!ifAny)
{
// False
}
else
{
// True
}
StudentRik
Member
26 Points
111 Posts
Linq query Syntax
Feb 28, 2013 11:14 AM|LINK
I am trying to check if the value is duplicate and where deleted == true
bool isDuplicate = _db.tbl_Issues .Any(x => x.IssueText == txt_Issue.Text) && (x => x.Deleted == true);But this is not working. I have tried a few different ways and no intellisence is coming up so it is wrong.
I have tried doing the .Where first but no luck.
How would I write this in method syntax.
farooque84
Participant
1358 Points
321 Posts
Re: Linq query Syntax
Feb 28, 2013 11:22 AM|LINK
Hi,
Check below code
If (From var As tblSample In Db.tblSamples Where var.field1 = 'required field').Count > 0 Then
Return True
Else
Return False
End If
matifnadeem
Contributor
4928 Points
1145 Posts
Re: Linq query Syntax
Feb 28, 2013 01:14 PM|LINK
Hi StudentRik,
ANY methods which returns a boolean value to determine whether all the elements of a sequence satisfy a condition. Please take a look at following snippet.
bool ifAny = (from d in _db.tbl_Issues where d.IssueText == txt_Issue.Text && d.Deleted == false select d).Any(); if (!ifAny) { // False } else { // True }Let me know if any query remains.
Cheers
M Atif Nadeem
Mark as Answer if you got right thing
Read my blog | Follow me on LinkedIn