private void Button_Click_1(object sender, RoutedEventArgs e) { this.Hide(); AltaAlmacen w = new AltaAlmacen(); w.Show(); }
public void iniciar() { SqlConnection con; SqlDataReader dr; SqlCommand cmd; try { con = Conexion.addConnection(); cmd = new SqlCommand(String.Format("select contra from usuarios where nombreUsuario= '{0}'", login), con); dr = cmd.ExecuteReader(); if (dr.Read()) { if (dr.GetString(0).Equals(pwd)) { MessageBox.Show("¡Contraseña válida!"); AltaAlmacen w = new AltaAlmacen(); w.Show(); } else { MessageBox.Show("¡Contraseña inválida!"); } } else { MessageBox.Show("¡Usuario incorrecto! :("); } dr.Close(); } catch (Exception ex) { MessageBox.Show("No se pudo conectar --" + ex); } }