Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox7.Text == "" || textBox8.Text == "" || textBox9.Text == "" || textBox10.Text == "")
            {
                MessageBox.Show("No pueden haber registros vacíos.");
            }
            else
            {
                try
                {
                    string query = "INSERT INTO paralelo(id,Cursocódigo,ProfesorRut,bono)VALUES(@valor1,@valor2,@valor3,@valor4)";

                    ConexMySQL conex = new ConexMySQL();
                    conex.open();
                    MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

                    cmd.Parameters.AddWithValue("@valor1", textBox7.Text);
                    cmd.Parameters.AddWithValue("@valor2", textBox8.Text);
                    cmd.Parameters.AddWithValue("@valor3", textBox9.Text);
                    cmd.Parameters.AddWithValue("@valor4", textBox10.Text);
                    cmd.Parameters.AddWithValue("@valor5", null);

                    cmd.ExecuteNonQuery();
                    conex.close();

                    MessageBox.Show("Se ingresaron los datos.");
                    Form4 f4 = new Form4(textBox7.Text, textBox8.Text);
                    f4.Show();
                }
                catch
                {
                    MessageBox.Show("Hubo un error (no hay un curso curso con ese código o no hay un profesor con ese rut). Intente nuevamente.");
                }
            }
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            string query = "Delete from reserva where id_reserva = @valor;";

            ConexMySQL conex = new ConexMySQL();

            conex.open();

            MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

            MySqlCommand cmd2 = new MySqlCommand("Select id_reserva From reserva Where id_reserva = @valorAux", conex.getConexion());

            cmd2.Parameters.AddWithValue("@valorAux", numericUpDown1.Value);

            cmd.Parameters.AddWithValue("@valor", numericUpDown1.Value);

            string me  = cmd2.ExecuteScalar().ToString();
            int    rut = Int16.Parse(me);

            if (rut == numericUpDown1.Value)
            {
                cmd.ExecuteNonQuery();


                MessageBox.Show("Se a eliminado La reserva correctamente");

                MostrarDatos1();
            }
            else
            {
                MessageBox.Show("La Reserva no existe como para eliminarse");
            }
            conex.close();
        }
Esempio n. 3
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (textBox4.Text == "")
     {
         MessageBox.Show("No pueden haber registros vacíos.");
     }
     else
     {
         try
         {
             conex = new ConexMySQL();
             conex.open();
             dt          = new DataTable();
             dataAdapter = new MySqlDataAdapter("SELECT * FROM paralelo p, profesor pr WHERE pr.rut = " + textBox4.Text + " AND pr.rut = p.Profesorrut", conex.getConexion());
             dataAdapter.Fill(dt);
             input       = dt.Rows[0][0].ToString();
             dataAdapter = new MySqlDataAdapter("SELECT COUNT(*) FROM paralelo p, profesor pr WHERE pr.rut = " + textBox4.Text + " AND pr.rut = p.Profesorrut", conex.getConexion());
             dataAdapter.Fill(dt);
             dataGridView1.DataSource = dt;
             conex.close();
         }
         catch
         {
             MessageBox.Show("Hubo un error (no existe un profesor con ese rut o no tiene paralelos asignados). Intente nuevamente.");
         }
     }
 }
Esempio n. 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox2.Text == "" || textBox3.Text == "")
     {
         MessageBox.Show("No pueden haber registros vacíos.");
     }
     else
     {
         try
         {
             conex = new ConexMySQL();
             conex.open();
             dt          = new DataTable();
             dataAdapter = new MySqlDataAdapter("SELECT * FROM paralelo p, estudiante e, estudiante_paralelo ep WHERE p.id = " + textBox2.Text + " AND p.Cursocódigo = " + textBox3.Text + " AND e.rut = ep.Estudianterut AND p.id = ep.Paraleloid AND p.Cursocódigo = ep.ParaleloCursocódigo", conex.getConexion());
             dataAdapter.Fill(dt);
             input       = dt.Rows[0][0].ToString();
             dataAdapter = new MySqlDataAdapter("SELECT COUNT(*) FROM paralelo p, estudiante e, estudiante_paralelo ep WHERE p.id = " + textBox2.Text + " AND p.Cursocódigo = " + textBox3.Text + " AND e.rut = ep.Estudianterut AND p.id = ep.Paraleloid AND p.Cursocódigo = ep.ParaleloCursocódigo", conex.getConexion());
             dataAdapter.Fill(dt);
             dataGridView1.DataSource = dt;
             conex.close();
         }
         catch
         {
             MessageBox.Show("Hubo un error (ese paralelo no existe o no hay estudiantes en ese paralelo). Intente nuevamente.");
         }
     }
 }
Esempio n. 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "")
            {
                MessageBox.Show("No pueden haber registros vacíos.");
            }
            else
            {
                try
                {
                    ConexMySQL conex = new ConexMySQL();
                    conex.open();
                    DataTable        dt          = new DataTable();
                    MySqlDataAdapter dataAdapter = new MySqlDataAdapter("SELECT rut FROM estudiante WHERE rut=" + textBox6.Text, conex.getConexion());
                    dataAdapter.Fill(dt);
                    string input = dt.Rows[0][0].ToString();
                    conex.close();

                    if (input != textBox6.Text)
                    {
                        MessageBox.Show("Hubo un error (el estudiante no existe). Intente nuevamente.");
                        return;
                    }

                    conex = new ConexMySQL();
                    conex.open();
                    dt          = new DataTable();
                    dataAdapter = new MySqlDataAdapter("SELECT id, Cursocódigo FROM paralelo WHERE id=" + textBox4.Text + "AND Cursocódigo=" + textBox5.Text, conex.getConexion());
                    dataAdapter.Fill(dt);
                    input = dt.Rows[0][0].ToString();
                    string input2 = dt.Rows[0][1].ToString();
                    conex.close();

                    if (input != textBox4.Text || input2 != textBox5.Text)
                    {
                        MessageBox.Show("Hubo un error (ese paralelo no existe). Intente nuevamente.");
                        return;
                    }

                    string query = "UPDATE paralelo SET rutCoordinador=@valor1 WHERE id=@valor2 AND Cursocódigo=@valor3";

                    conex = new ConexMySQL();
                    conex.open();
                    MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

                    cmd.Parameters.AddWithValue("@valor1", textBox6.Text);
                    cmd.Parameters.AddWithValue("@valor2", textBox4.Text);
                    cmd.Parameters.AddWithValue("@valor3", textBox5.Text);

                    cmd.ExecuteNonQuery();
                    conex.close();

                    MessageBox.Show("Se ingresó el dato.");
                }
                catch
                {
                    MessageBox.Show("Hubo un error (no existe ese paralelo o no hay estudiante con ese rut). Intente nuevamente.");
                }
            }
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)//agrega un estudiante a un paralelo
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
            {
                MessageBox.Show("No pueden haber registros vacíos.");
            }
            else
            {
                try
                {
                    string query = "INSERT INTO estudiante_paralelo(Estudianterut,Paraleloid,ParaleloCursocódigo,fechaInscripcion)VALUES(@valor1,@valor2,@valor3,@valor4)";

                    ConexMySQL conex = new ConexMySQL();
                    conex.open();
                    MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

                    cmd.Parameters.AddWithValue("@valor1", textBox1.Text);
                    cmd.Parameters.AddWithValue("@valor2", textBox2.Text);
                    cmd.Parameters.AddWithValue("@valor3", textBox3.Text);
                    cmd.Parameters.AddWithValue("@valor4", DateTime.Now);

                    cmd.ExecuteNonQuery();
                    conex.close();

                    MessageBox.Show("Se ingresaron los datos.");
                }
                catch
                {
                    MessageBox.Show("Hubo un error (no hay estudiante con ese rut o no existe ese paralelo). Intente nuevamente.");
                }
            }
        }
Esempio n. 7
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (textBox11.Text == "" || textBox12.Text == "" || textBox13.Text == "")
            {
                MessageBox.Show("No pueden haber registros vacíos.");
            }
            else
            {
                try
                {
                    string query = "INSERT INTO estudiante(rut,nombre,fechaIngreso,fechaNacimiento) VALUES(@valor1,@valor2,@valor3,@valor4)";

                    ConexMySQL conex = new ConexMySQL();
                    conex.open();
                    MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

                    cmd.Parameters.AddWithValue("@valor1", textBox11.Text);
                    cmd.Parameters.AddWithValue("@valor2", textBox12.Text);
                    cmd.Parameters.AddWithValue("@valor3", DateTime.Now);
                    cmd.Parameters.AddWithValue("@valor4", textBox13.Text);

                    cmd.ExecuteNonQuery();
                    conex.close();

                    MessageBox.Show("Se ingresaron los datos.");
                }
                catch
                {
                    MessageBox.Show("Hubo un error (el estudiante ya existe). Intente nuevamente.");
                }
            }
        }
Esempio n. 8
0
        private void button3_Click(object sender, EventArgs e)
        {
            string query = "Delete from automovil where Patente = @valor;";

            ConexMySQL conex = new ConexMySQL();

            conex.open();

            MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

            MySqlCommand cmd2 = new MySqlCommand("Select Patente From automovil Where Patente = @valorAux", conex.getConexion());

            cmd2.Parameters.AddWithValue("@valorAux", textBox3.Text);

            cmd.Parameters.AddWithValue("@valor", textBox3.Text);


            string Patente = cmd2.ExecuteScalar().ToString();

            if (Patente == textBox3.Text)
            {
                cmd.ExecuteNonQuery();


                MessageBox.Show("Se a eliminado el automovil correctamente");

                MostrarDatos1();
            }
            else
            {
                MessageBox.Show("La Patente no existe como para eliminarse");
            }
            conex.close();
        }
Esempio n. 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            string query = "INSERT INTO automovil VALUES(@valor1 ,@valor2,@valor3,@valor4,@valor5,@valor6,@valor7,@valor8)";

            ConexMySQL conex = new ConexMySQL();

            conex.open();
            MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

            cmd.Parameters.AddWithValue("@valor1", t.Text);
            cmd.Parameters.AddWithValue("@valor2", numericUpDown4.Value);
            cmd.Parameters.AddWithValue("@valor3", t2.Text);
            cmd.Parameters.AddWithValue("@valor4", textBox2.Text);
            cmd.Parameters.AddWithValue("@valor5", numericUpDown3.Value);
            cmd.Parameters.AddWithValue("@valor6", textBox1.Text);
            cmd.Parameters.AddWithValue("@valor7", numericUpDown1.Value);
            cmd.Parameters.AddWithValue("@valor8", numericUpDown2.Value);


            cmd.ExecuteNonQuery();
            conex.close();

            MostrarDatos1();
            MessageBox.Show("Se ingresaron los datos");
        }
Esempio n. 10
0
        private void MostrarDatos(string tabla)
        {
            ConexMySQL conex = new ConexMySQL();

            conex.open();
            DataTable dt = new DataTable();

            adapt = new MySqlDataAdapter("SELECT * FROM " + tabla + ";", conex.getConexion());
            adapt.Fill(dt);
            DataGrid.DataSource = dt;
            conex.close();
        }
Esempio n. 11
0
        private void MostrarDatos1()
        {
            ConexMySQL conex = new ConexMySQL();

            conex.open();

            DataTable dt = new DataTable();

            MySqlDataAdapter adapt = new MySqlDataAdapter("Select * from automovil;", conex.getConexion());

            adapt.Fill(dt);
            Datos.DataSource = dt;

            conex.close();
        }
Esempio n. 12
0
 private void button10_Click(object sender, EventArgs e)
 {
     try
     {
         conex = new ConexMySQL();
         conex.open();
         dt          = new DataTable();
         dataAdapter = new MySqlDataAdapter("SELECT * FROM estudiante e WHERE DATE_FORMAT(e.fechaIngreso, '%Y') BETWEEN '0000' AND '2016'", conex.getConexion());
         dataAdapter.Fill(dt);
         dataGridView1.DataSource = dt;
         conex.close();
     }
     catch
     {
         MessageBox.Show("Hubo un error (no hay ningún estudiante en algún paralelo). Intente nuevamente.");
     }
 }
Esempio n. 13
0
 private void button7_Click(object sender, EventArgs e)
 {
     try
     {
         conex = new ConexMySQL();
         conex.open();
         dt          = new DataTable();
         dataAdapter = new MySqlDataAdapter("SELECT * FROM estudiante e WHERE Timestampdiff(year, e.fechaNacimiento, now()) < 18", conex.getConexion());
         dataAdapter.Fill(dt);
         dataGridView1.DataSource = dt;
         conex.close();
     }
     catch
     {
         MessageBox.Show("Hubo un error. Intente nuevamente.");
     }
 }
Esempio n. 14
0
 private void button11_Click(object sender, EventArgs e)
 {
     try
     {
         conex = new ConexMySQL();
         conex.open();
         dt          = new DataTable();
         dataAdapter = new MySqlDataAdapter("SELECT y.cantEstudiantes, y.cursoCod, y.nombreCurso FROM (SELECT COUNT(*) cantEstudiantes, ep.ParaleloCursocódigo cursoCod, c.nombre nombreCurso FROM estudiante_paralelo ep, Curso c WHERE c.código = ep.ParaleloCursocódigo GROUP BY ep.ParaleloCursocódigo) y WHERE y.cantEstudiantes = (SELECT MAX(z.maxEstudiantes) FROM(select count(*) maxEstudiantes FROM Estudiante_Paralelo ep1, Curso c1 WHERE c1.código = ep1.ParaleloCursocódigo GROUP BY ep1.ParaleloCursocódigo) z ); ", conex.getConexion());
         dataAdapter.Fill(dt);
         dataAdapter = new MySqlDataAdapter("SELECT y.cantEstudiantes, y.cursoCod, y.nombreCurso FROM (SELECT COUNT(*) cantEstudiantes, ep.ParaleloCursocódigo cursoCod, c.nombre nombreCurso FROM estudiante_paralelo ep, Curso c WHERE c.código = ep.ParaleloCursocódigo GROUP BY ep.ParaleloCursocódigo) y WHERE y.cantEstudiantes = (SELECT MIN(z.maxEstudiantes) FROM(select count(*) maxEstudiantes FROM Estudiante_Paralelo ep1, Curso c1 WHERE c1.código = ep1.ParaleloCursocódigo GROUP BY ep1.ParaleloCursocódigo) z ); ", conex.getConexion());
         dataAdapter.Fill(dt);
         dataGridView1.DataSource = dt;
         conex.close();
     }
     catch
     {
         MessageBox.Show("Hubo un error. Intente nuevamente.");
     }
 }
Esempio n. 15
0
 private void button8_Click(object sender, EventArgs e)
 {
     try
     {
         conex = new ConexMySQL();
         conex.open();
         dt          = new DataTable();
         dataAdapter = new MySqlDataAdapter("SELECT * FROM profesor pr1 WHERE Timestampdiff(year, pr1.fechaContratacion, now()) = (SELECT max(Timestampdiff(year, pr2.fechaContratacion, now())) FROM profesor pr2)", conex.getConexion());
         dataAdapter.Fill(dt);
         dataAdapter = new MySqlDataAdapter("SELECT * FROM profesor pr1 WHERE Timestampdiff(year, pr1.fechaContratacion, now()) = (SELECT max(Timestampdiff(year, pr2.fechaContratacion, now())) FROM profesor pr2)", conex.getConexion());
         dataAdapter.Fill(dt);
         dataGridView1.DataSource = dt;
         conex.close();
     }
     catch
     {
         MessageBox.Show("Hubo un error (no hay profesores). Intente nuevamente.");
     }
 }
Esempio n. 16
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox8.Text == "" || textBox9.Text == "" || textBox10.Text == "")
            {
                MessageBox.Show("No pueden haber registros vacíos.");
            }
            else
            {
                try
                {
                    ConexMySQL conex = new ConexMySQL();
                    conex.open();
                    DataTable        dt          = new DataTable();
                    MySqlDataAdapter dataAdapter = new MySqlDataAdapter("SELECT id, Cursocódigo FROM paralelo WHERE id=" + textBox8.Text + " AND Cursocódigo = " + textBox9.Text, conex.getConexion());
                    dataAdapter.Fill(dt);
                    string input  = dt.Rows[0][0].ToString();
                    string input2 = dt.Rows[0][1].ToString();
                    conex.close();
                    if (input == textBox8.Text & input2 == textBox9.Text)
                    {
                        string query = "UPDATE paralelo SET bono=@valor1 WHERE id=@valor2 AND Cursocódigo=@valor3";

                        conex = new ConexMySQL();
                        conex.open();
                        MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

                        cmd.Parameters.AddWithValue("@valor1", textBox10.Text);
                        cmd.Parameters.AddWithValue("@valor2", textBox8.Text);
                        cmd.Parameters.AddWithValue("@valor3", textBox9.Text);

                        cmd.ExecuteNonQuery();
                        conex.close();
                        MessageBox.Show("Se cambiaron los datos.");
                    }
                }
                catch
                {
                    MessageBox.Show("Hubo un error (el paralelo no existe). Intente nuevamente.");
                }
            }
        }
Esempio n. 17
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string query = "insert into reserva (fecha_inicio,fecha_final,Precio,Cliente_rut) VALUES(@valor1 ,@valor2,@valor3,@valor4)";

            ConexMySQL conex = new ConexMySQL();

            conex.open();
            MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

            cmd.Parameters.AddWithValue("@valor1", dateTimePicker1.Value);
            cmd.Parameters.AddWithValue("@valor2", dateTimePicker2.Value);
            cmd.Parameters.AddWithValue("@valor3", numericUpDown2.Value);
            cmd.Parameters.AddWithValue("@valor4", textBox2.Text);



            cmd.ExecuteNonQuery();
            conex.close();

            MostrarDatos1();
            MessageBox.Show("Se ingresaron los datos");
        }
Esempio n. 18
0
 private void button12_Click(object sender, EventArgs e)
 {
     if (textBox10.Text == "")
     {
         MessageBox.Show("No pueden haber registros vacíos.");
     }
     else
     {
         try
         {
             conex = new ConexMySQL();
             conex.open();
             dt          = new DataTable();
             dataAdapter = new MySqlDataAdapter("SELECT SUM(x.bono) FROM(SELECT p.rut, pa.bono FROM profesor AS p , paralelo AS pa WHERE p.rut = pa.Profesorrut) AS x WHERE x.rut = " + textBox10.Text, conex.getConexion());
             dataAdapter.Fill(dt);
             dataGridView1.DataSource = dt;
             conex.close();
         }
         catch
         {
             MessageBox.Show("Hubo un error. Intente nuevamente.");
         }
     }
 }
Esempio n. 19
0
 private void button9_Click(object sender, EventArgs e)
 {
     if (textBox8.Text == "" || textBox9.Text == "")
     {
         MessageBox.Show("No pueden haber registros vacíos.");
     }
     else
     {
         try
         {
             conex = new ConexMySQL();
             conex.open();
             dt          = new DataTable();
             dataAdapter = new MySqlDataAdapter("SELECT COUNT(*) FROM estudiante_paralelo ep WHERE ep.Paraleloid =" + textBox8.Text + " AND ep.ParaleloCursocódigo =" + textBox9.Text + " AND((DATE_FORMAT(ep.fechaInscripcion, '%H:%i') BETWEEN '08:00' AND '12:30') OR (DATE_FORMAT(ep.fechaInscripcion, '%H:%i') BETWEEN '14:30' AND '18:30'))", conex.getConexion());
             dataAdapter.Fill(dt);
             dataGridView1.DataSource = dt;
             conex.close();
         }
         catch
         {
             MessageBox.Show("Hubo un error. Intente nuevamente.");
         }
     }
 }
Esempio n. 20
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (textBox7.Text == "")
     {
         MessageBox.Show("No pueden haber registros vacíos.");
     }
     else
     {
         try
         {
             conex = new ConexMySQL();
             conex.open();
             dt          = new DataTable();
             dataAdapter = new MySqlDataAdapter("SELECT * FROM profesor pr WHERE pr.rut = " + textBox7.Text, conex.getConexion());
             dataAdapter.Fill(dt);
             dataGridView1.DataSource = dt;
             conex.close();
         }
         catch
         {
             MessageBox.Show("Hubo un error. Intente nuevamente.");
         }
     }
 }
Esempio n. 21
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
            {
                MessageBox.Show("No pueden haber registros vacíos.");
            }
            else
            {//se borrará al estudiante del paralelo
                try
                {
                    ConexMySQL conex = new ConexMySQL();
                    conex.open();
                    DataTable        dt          = new DataTable();
                    MySqlDataAdapter dataAdapter = new MySqlDataAdapter("SELECT id, Cursocódigo FROM paralelo WHERE id=" + textBox4.Text + "AND Cursocódigo=" + textBox5.Text, conex.getConexion());
                    dataAdapter.Fill(dt);
                    string input  = dt.Rows[0][0].ToString();
                    string input2 = dt.Rows[0][1].ToString();
                    conex.close();

                    if (input != textBox4.Text || input2 != textBox5.Text)
                    {
                        MessageBox.Show("Hubo un error (ese paralelo no existe). Intente nuevamente.");
                        return;
                    }

                    string query = "DELETE FROM estudiante_paralelo WHERE Estudianterut=@valor1 AND Paraleloid=@valor2 AND ParaleloCursocódigo=@valor3";

                    conex = new ConexMySQL();
                    conex.open();
                    MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

                    cmd.Parameters.AddWithValue("@valor1", textBox1.Text);
                    cmd.Parameters.AddWithValue("@valor2", textBox2.Text);
                    cmd.Parameters.AddWithValue("@valor3", textBox3.Text);

                    cmd.ExecuteNonQuery();
                    conex.close();

                    //se buscará el rutCoordinador del paralelo del que se borró el estudiante
                    conex = new ConexMySQL();
                    conex.open();
                    dt          = new DataTable();
                    dataAdapter = new MySqlDataAdapter("SELECT rutCoordinador FROM paralelo WHERE id=" + textBox2.Text + " AND Cursocódigo=" + textBox3.Text + ";", conex.getConexion());
                    dataAdapter.Fill(dt);
                    input = dt.Rows[0][0].ToString();
                    conex.close();

                    if (input == textBox1.Text)//si el estudiante era el coordinador del curso, se borra su rutCoordinador de paralelo
                    {
                        query = "UPDATE paralelo SET rutCoordinador=@valor1 WHERE id=@valor2 AND Cursocódigo=@valor3";

                        conex = new ConexMySQL();
                        conex.open();
                        cmd = new MySqlCommand(query, conex.getConexion());

                        cmd.Parameters.AddWithValue("@valor1", null);
                        cmd.Parameters.AddWithValue("@valor2", textBox2.Text);
                        cmd.Parameters.AddWithValue("@valor3", textBox3.Text);

                        cmd.ExecuteNonQuery();
                        conex.close();
                    }
                    MessageBox.Show("Se borraron los datos.");
                }
                catch
                {
                    MessageBox.Show("Hubo un error (ese paralelo no existe o no hay estudiante con ese rut o el estudiante no está en ese paralelo). Intente nuevamente.");
                }
            }
        }
Esempio n. 22
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "")
            {
                MessageBox.Show("No pueden haber registros vacíos.");
            }
            else
            {
                try
                {
                    ConexMySQL conex = new ConexMySQL();
                    conex.open();
                    DataTable        dt          = new DataTable();
                    MySqlDataAdapter dataAdapter = new MySqlDataAdapter("SELECT rut FROM estudiante WHERE rut=" + textBox1.Text, conex.getConexion());
                    dataAdapter.Fill(dt);
                    string input = dt.Rows[0][0].ToString();
                    conex.close();
                    if (input == textBox1.Text)//si el estudiante con ese rut existe
                    {
                        conex = new ConexMySQL();
                        conex.open();
                        dt          = new DataTable();
                        dataAdapter = new MySqlDataAdapter("SELECT Estudianterut FROM estudiante_paralelo WHERE Estudianterut=" + textBox1.Text + "Paraleloid=" + textBox2.Text + " AND ParaleloCursocódigo=" + textBox5.Text, conex.getConexion());
                        dataAdapter.Fill(dt);
                        input = dt.Rows[0][0].ToString();
                        conex.close();
                        if (input == textBox1.Text)//si el estudiante está inscrito en el paralelo actual
                        {
                            conex = new ConexMySQL();
                            conex.open();
                            dt          = new DataTable();
                            dataAdapter = new MySqlDataAdapter("SELECT Estudianterut FROM estudiante_paralelo WHERE Estudianterut=" + textBox1.Text + "Paraleloid=" + textBox2.Text + " AND ParaleloCursocódigo=" + textBox5.Text, conex.getConexion());
                            dataAdapter.Fill(dt);
                            input = dt.Rows[0][0].ToString();
                            conex.close();
                            if (input == "")//si el estudiante no está inscrito en el paralelo nuevo
                            {
                                string query = "DELETE FROM estudiante_paralelo WHERE Estudianterut=@valor1 AND Paraleloid=@valor2 AND ParaleloCursocódigo=@valor3";

                                conex = new ConexMySQL();
                                conex.open();
                                MySqlCommand cmd = new MySqlCommand(query, conex.getConexion());

                                cmd.Parameters.AddWithValue("@valor1", textBox1.Text);
                                cmd.Parameters.AddWithValue("@valor2", textBox2.Text);
                                cmd.Parameters.AddWithValue("@valor3", textBox5.Text);

                                cmd.ExecuteNonQuery();
                                conex.close();

                                //se buscará el rutCoordinador del paralelo del que se borró el estudiante
                                conex = new ConexMySQL();
                                conex.open();
                                dt          = new DataTable();
                                dataAdapter = new MySqlDataAdapter("SELECT rutCoordinador FROM paralelo WHERE id=" + textBox2.Text + " AND Cursocódigo=" + textBox3.Text + ";", conex.getConexion());
                                dataAdapter.Fill(dt);
                                input = dt.Rows[0][0].ToString();
                                conex.close();

                                if (input == textBox1.Text)//si el estudiante era el coordinador del curso, se borra su rutCoordinador de paralelo
                                {
                                    query = "UPDATE paralelo SET rutCoordinador=@valor1 WHERE id=@valor2 AND Cursocódigo=@valor3";

                                    conex = new ConexMySQL();
                                    conex.open();
                                    cmd = new MySqlCommand(query, conex.getConexion());

                                    cmd.Parameters.AddWithValue("@valor1", null);
                                    cmd.Parameters.AddWithValue("@valor2", textBox2.Text);
                                    cmd.Parameters.AddWithValue("@valor3", textBox5.Text);

                                    cmd.ExecuteNonQuery();
                                    conex.close();
                                }
                                //se agregará el estudiante al paralelo nuevo
                                query = "INSERT INTO estudiante_paralelo(Estudianterut,Paraleloid,ParaleloCursocódigo,fechaInscripcion)VALUES(@valor1,@valor2,@valor3,@valor4)";

                                conex = new ConexMySQL();
                                conex.open();
                                cmd = new MySqlCommand(query, conex.getConexion());

                                cmd.Parameters.AddWithValue("@valor1", textBox1.Text);
                                cmd.Parameters.AddWithValue("@valor2", textBox3.Text);
                                cmd.Parameters.AddWithValue("@valor3", textBox5.Text);
                                cmd.Parameters.AddWithValue("@valor4", DateTime.Now);

                                cmd.ExecuteNonQuery();
                                conex.close();
                                MessageBox.Show("Se cambiaron los datos.");
                            }
                            else
                            {
                                MessageBox.Show("El estudiante está inscrito en ese paralelo nuevo.");
                            }
                        }
                        else
                        {
                            MessageBox.Show("El estudiante no está inscrito en ese paralelo actual.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("No hay estudiante con ese rut.");
                    }
                }
                catch
                {
                    MessageBox.Show("Hubo un error (paralelo nuevo o paralelo actual no existen). Intente nuevamente.");
                }
            }
        }