Esempio n. 1
0
        //Prueba de Login funcional
        public void logins()
        {
            try
            {
                string EcoApp = ConfigurationManager.ConnectionStrings["EcoApp"].ConnectionString;
                using (SqlConnection conexion = new SqlConnection(EcoApp))
                {
                    conexion.Open();
                    using (SqlCommand cmd = new SqlCommand("SELECT Username, Password FROM Users WHERE Username='******' AND Password='******'", conexion))
                    {
                        SqlDataReader dr = cmd.ExecuteReader();

                        if (dr.Read())
                        {
                            this.Hide();
                            Form pantallaPrincipal = new frmPantallaP();
                            pantallaPrincipal.Show();
                            lblError.Visible = false;
                        }
                        else
                        {
                            lblError.Visible = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 2
0
 private void btnIniciar_Click(object sender, EventArgs e)
 {
     if (txtUsuario.Text == "admin" && txtContra.Text == "1234")
     {
         this.Hide();
         Form pantallaPrincipal = new frmPantallaP();
         pantallaPrincipal.Show();
         lblError.Visible = false;
     }
     else if (txtUsuario.Text != "Usuario" || txtContra.Text != "Contraseña")
     {
         lblError.Visible = true;
     }
 }