how can i check linq query return with value or not ??
-
hi every body i want know the way which i can check the query result and is it has value or not ex: i made this query var res = from x in rs.Users where x.UserName == "name" select x; i want check if res has value or not thanx for ur time
-
hi every body i want know the way which i can check the query result and is it has value or not ex: i made this query var res = from x in rs.Users where x.UserName == "name" select x; i want check if res has value or not thanx for ur time
bool hasValue = res.Count > 0;
Deja View - the feeling that you've seen this post before.
-
hi every body i want know the way which i can check the query result and is it has value or not ex: i made this query var res = from x in rs.Users where x.UserName == "name" select x; i want check if res has value or not thanx for ur time
-
var res = (from x in rs.Users
where x.UserName == "name"
select x).FirstOrDefault();if res == null after that then no record was returtned, otherwise res will have the value of x. You may also like to lookup
SingleOrDefault()
which is similar.