private void PictureBox6_Click(object sender, EventArgs e)
        {
            Menu_Admin m = new Menu_Admin();

            m.Show();
            this.Hide();
        }
Пример #2
0
 public void login(string user, string pass)
 {
     try
     {
         conn.Open();
         SqlCommand cmd = new SqlCommand("SELECT * FROM Administradores WHERE Alias_administrador = @usuario AND Clave_administrador = @clave", conn);
         cmd.Parameters.AddWithValue("usuario", user);
         cmd.Parameters.AddWithValue("clave", pass);
         SqlDataAdapter sda = new SqlDataAdapter(cmd);
         DataTable      dt  = new DataTable();
         sda.Fill(dt);
         if (dt.Rows.Count == 1)
         {
             MessageBox.Show("Bienvenido, administrador", "Hecho", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Menu_Admin m = new Menu_Admin();
             m.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Usuario o clave incorrectos", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception error)
     {
         MessageBox.Show("Usuario o clave incorrectos", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         conn.Close();
     }
 }