You are redundantly checking the passed credentials: the first time with the SQL query, the second time with code inside the loop.
You might change
Quote:
while (dr.Read())
{
if ((dr["Password"].ToString() == pass && dr["Username"].ToString() == user && dr["Occupation"].ToString() == role))
{
messageBox.Show("Login Successful");
}
else
{
MessageBox.Show("LOGIN NOT SUCCESSFUL );
}
}
to
if ( dr.hasRows )
messageBox.Show("Login Successful");
else
messageBox.Show("LOGIN NOT SUCCESSFUL");