private void btnComprobar_Click(object sender, EventArgs e) { cn.Open(); cmd.Connection = cn; try { cmd.CommandText = "select count(*) from tbusuarios where nickname = '" + txtUsuarios.Text + "'"; int valor = int.Parse(cmd.ExecuteScalar().ToString()); //Comparamos si el valor recibido es 1 entonces existe si no NO if (valor == 1) { frmPreguntasSeguridad_RecuperarContra frm = new frmPreguntasSeguridad_RecuperarContra(); frm.Show(); this.Hide(); } else { labelMensaje.Text = "El usuario no existe"; } } catch (Exception ex) { MessageBox.Show("Error en encontrar usuario" + ex, "Error de encontrame al usuario", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } cn.Close(); }
private void pbPreguntas_Recu_Click(object sender, EventArgs e) { frmPreguntasSeguridad_RecuperarContra pregunta = new frmPreguntasSeguridad_RecuperarContra(); pregunta.Show(); this.Close(); }
private void pbPreguntas_Click(object sender, EventArgs e) { frmPreguntasSeguridad_RecuperarContra frm = new frmPreguntasSeguridad_RecuperarContra(); frm.Show(); this.Hide(); }