I am working with a MySQL sign up/registration system. If the user and pass are correct and has permission 0, he will log in as guest; if the user and pass are correct and user has permission 1, he will log in as administrator. If the user is guest, I want to open Form1, if he is admin, I will open Form 2. At this point my program reads / writes to the MySQL DB. How can I read a specific value (permission) and write conditionals depending on the result?
Auth :
private bool validate_login(string user, string pass)
{
db_connection();
MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = "Select * from miembros where usuario=@user and contraseña=@pass";
cmd.Parameters.AddWithValue("@user", textBox1.Text);
cmd.Parameters.AddWithValue("@pass", textBox2.Text);
cmd.Connection = connect;
MySqlDataReader login = cmd.ExecuteReader();
if (login.Read())
{
connect.Close();
return true;
}
else
{
connect.Close();
return false;
}
}