private void btnRegresar_Click(object sender, EventArgs e) { frmMenuUsuario a = new frmMenuUsuario(); a.Show(); this.Close(); }
private void btnIngresar_Click(object sender, EventArgs e) { SqlConnection conexion = new SqlConnection("Server= (local); Database=TOTALGYM; integrated security = true"); conexion.Open(); string user = txtUsuario.Text; string pass = txtContraseña.Text; string tipo; string pass2; string cadena=("select ID_Cliente,Contraseña, Tipo from TIPO where ID_Cliente="+user); SqlCommand comando = new SqlCommand(cadena,conexion); SqlDataReader read = comando.ExecuteReader(); if (read.Read()) { pass2 = read["Contraseña"].ToString(); tipo= read["tipo"].ToString(); if (pass2==txtContraseña.Text){ if(tipo=="administrador"){ frmMenuUsuario add = new frmMenuUsuario(); add.Show(); this.Hide(); } if (tipo=="Usuario") { frmMenuPrincipal add = new frmMenuPrincipal(); add.Show(); this.Hide(); } if (tipo == "cliente") { frmMenuPrincipal prin = new frmMenuPrincipal(); prin.Show(); this.Hide(); } } } else { MessageBox.Show("!Usuario/Contraseña incorrectos,Verifique bien los datos¡"); } }