I'm trying to get the IsAdmin Value with SQL query(This query return 1 line or 0). but i get this error {"invalide reading Tentative there are no any data present."} This is my code
public static bool Login (string iduser, string password, bool IsAdmin)
{
bool auth = false;
string query = string.Format("Select IsAdmin from [user] where iduser = '{0}' AND mdp = '{1}' ;", iduser, password);
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
SqlDataReader re = cmd.ExecuteReader();
auth = re.HasRows;
if (auth) { IsAdmin = re.GetBoolean(0); } // the error is on this line (this line will alow me to get IsAdmin Value If the user exist)
con.Close();
return auth;
}
'; drop table [user]; --