Esempio n. 1
0
        private void btnBaseDeDatos_Click(object sender, EventArgs e)
        {
            PrincipalBD principalBD = new PrincipalBD();

            this.Hide();
            principalBD.Show();
        }
Esempio n. 2
0
        private void btnModProfesor_Click(object sender, EventArgs e)
        {
            Conexion modDatosBD = new Conexion();

            try
            {
                PrincipalBD principalBD = new PrincipalBD();
                int         edad        = Convert.ToInt32(txtModEdad.Text);
                float       promeEncu   = Convert.ToSingle(txtModPromEncu.Text);
                modDatosBD.modificarDatos(txtModRut.Text, txtModNombres.Text, edad, txtModProf1.Text, txtModProf2.Text, promeEncu);
                txtModRut.Text = txtModNombres.Text = txtModEdad.Text = txtModProf1.Text = txtModProf2.Text = txtModPromEncu.Text = "";
                principalBD.dgvMostrarDatos.DataSource = modDatosBD.actualizarDgv();
            }
            catch (InvalidCastException ex)
            {
                MessageBox.Show("Error de formato de los numeros\n" + ex.Message);
            }
            catch (SystemException se)
            {
                MessageBox.Show("Error\n" + se.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        private void btnEliminarBD_Click(object sender, EventArgs e)
        {
            PrincipalBD principalBD = new PrincipalBD();

            elimBDCon.eliminarDatos(txtElimRut.Text);
            txtElimRut.Text = "";
            principalBD.dgvMostrarDatos.DataSource = elimBDCon.actualizarDgv();
        }
Esempio n. 4
0
        public DataTable actualizarDgv()
        {
            try
            {
                PrincipalBD princBD = new PrincipalBD();
                DataTable   dt1     = new DataTable();
                abrirConexion();
                SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM profesores", con);
                dt1.Clear();
                adapter.Fill(dt1);

                cerrarConexion();
                return(dt1);
            }
            catch (SqlException se)
            {
                MessageBox.Show(se.Message);
                cerrarConexion();
                return(null);
            }
        }
Esempio n. 5
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         PrincipalBD principalBD = new PrincipalBD();
         int         edad        = Convert.ToInt32(txtIngEdad.Text);
         float       promeEncu   = Convert.ToSingle(txtPromEncu.Text);
         agrDatosCon.agregarDatos(txtIngRut.Text, txtIngNombre.Text, edad, txtIngProf1.Text, txtIngProf2.Text, promeEncu);
         txtIngRut.Text = txtIngNombre.Text = txtIngEdad.Text = txtIngProf1.Text = txtIngProf2.Text = txtPromEncu.Text = "";
         principalBD.dgvMostrarDatos.DataSource = agrDatosCon.actualizarDgv();
     }
     catch (InvalidCastException ex)
     {
         MessageBox.Show("Error de formato de los numeros\n" + ex.Message);
     }
     catch (SystemException se)
     {
         MessageBox.Show("Error\n" + se.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }