OK I have the following code that I run inside a button clicked event in order to compare the username and password given by the user.
public static bool isAuthenticated(string Username, string Password)
{
//Open a connection with the database
using (WHDataDataContext db = new WHDataDataContext())
{
//Compare the Username and the password and return the result
return db.Users.Any(check => check.Username == Username && check.Password == Cryptographer.Encrypt(Password));
}
}
My problem is that when I hit the button the program freezes for a moment and the it responds.
I have used this code on a c# application with .sdf file (SQL CE) and I haven't experienced this issue.
Could anyone please help?