Que: Which of the following sample code is used to select data Using LinQ To SQL?

a. public bool IsValidUser(string userName, string passWord){DBNameDataContext myDB = NEW DBNameDataContext();RETURN Enumerable.Count(userResults) > 0;}
b. public bool IsValidUser(string userName, string passWord){DBNameDataContext myDB = NEW DBNameDataContext();var userResults = FROM u IN myDB.UsersWHERE u.Username == userName&& u.Password == passWordSELECT u;RETURN Enumerable.Count(userResults) > 0;}
c. public bool IsValidUser(string userName, string passWord){DBNameDataContext myDB = NEW DBNameDataContext();var userResults = FROM u IN myDB.UsersWHERE u.Username == userName&& u.Password == passWordSELECT u;RETURN Enumerable.Count(userResults) == 0;}
d. All of the mentioned
Answer: public bool IsValidUser(string userName, string passWord){DBNameDataContext myDB = NEW DBNameDataContext();var userResults = FROM u IN myDB.UsersWHERE u.Username == userName&& u.Password == passWordSELECT u;RETURN Enumerable.Count(userResults) > 0;}

Leave a Comment