//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()); } }
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; } }