private void btnlogin_Click(object sender, EventArgs e) { i = 0; cn.Open(); MySqlCommand cmd = cn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from Login where Usuario ='" + txtusuario.Text + "' and Contraseña ='" + txtpassword.Text + "'"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); i = Convert.ToInt32(dt.Rows.Count.ToString()); if (txtpassword.Text != "" && txtusuario.Text != "") { if (i == 0) { MessageBox.Show("Ha ingresado un usuario o contraseña invalido"); txtpassword.Clear(); txtusuario.Clear(); txtusuario.Focus(); } else { MessageBox.Show("Bienvenido"); Menu_Principal forma = new Menu_Principal(); forma.Show(); this.Hide(); } } else { MessageBox.Show("Rellene ambos campos."); txtpassword.Clear(); txtusuario.Clear(); txtusuario.Focus(); } cn.Close(); }
private void Buscar_Alumno_FormClosed(object sender, FormClosedEventArgs e) { Menu_Principal menu = new Menu_Principal(); menu.Show(); }
private void Registro_del_alumno_FormClosed(object sender, FormClosedEventArgs e) { Menu_Principal forma = new Menu_Principal(); forma.Show(); }
private void camposformativos_FormClosed(object sender, FormClosedEventArgs e) { Menu_Principal forma = new Menu_Principal(); forma.Show(); }
private void ConsultaAlumnado_FormClosed(object sender, FormClosedEventArgs e) { Menu_Principal forma = new Menu_Principal(); forma.Show(); }