This is my code
public static bool Login (string iduser, string password)
{
bool auth = false;
string query = string.Format("Select * from [user] where iduser = '{0}' AND password = '{1}' ;", iduser, password);
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
SqlDataReader re = cmd.ExecuteReader();
auth = re.HasRows;
con.Close();
return auth;
}
When I execute my program an error appears on this line “SqlDataReader re = cmd.ExecuteReader();”. The error message is: Invalid password colonne
The error is pretty self explanatory. Your password coming from your
conobject is invalid. I would double check where that is being populated and make sure it is correct, since it appears to be a global variable.