username and password check linq query in c#
Posted
by b0x0rz
on Stack Overflow
See other posts from Stack Overflow
or by b0x0rz
Published on 2010-05-22T14:55:06Z
Indexed on
2010/05/22
15:00 UTC
Read the original article
Hit count: 364
this linq query
var users = from u in context.Users
where u.UserEMailAdresses.Any(e1 => e1.EMailAddress == userEMail) && u.UserPasswords.Any(e2 => e2.PasswordSaltedHash == passwordSaltedHash)
select u;
return users.Count();
returns: 1 even when there is nothing in password table.
how come?
what i am trying to do is get the values of email and passwordHash from two separate tables (UserEMailAddresses and UserPasswords) linked via foreign keys to the third table (Users).
it should be simple - checking if email and password mach from form to database. but it is not working for me.
i get 1 (for count) even when there are NO entries in the UserPasswords table.
is the linq query above completely wrong, or...?
© Stack Overflow or respective owner