Exemplo n.º 1
0
        private void btbuscar_Click(object sender, EventArgs e)
        {
            string sql = "Exec sp_consulta_Estudiantes'" + txtcriterio.Text + "'";

            conexionesdb consulta = new conexionesdb();

            consulta.Consulta(sql);
            dgresultado.DataSource = consulta.Consulta(sql);
        }
Exemplo n.º 2
0
        private void btGuardar_Click(object sender, EventArgs e)
        {
            if
            (txnombre.Text != "" && txapellido1.Text != "" && txfamiliar.Text != "" && txcarrera.Text != "" && txdireccion.Text != "" &&
             cbtipoiden.Text != "" && mtnoiden.Text != "" && mttelefono.Text != "" && mtmatricula.Text != "" &&
             rbm.Checked == true || rbf.Checked)

            {
                string genero = "";
                if (rbm.Checked == true)
                {
                    genero = "M";
                }
                else
                {
                    genero = "F";
                }

                string sql = "exec sp_inserta_Estudiantes'" +
                             txnombre.Text + "','" +
                             txapellido1.Text + "','" +
                             genero + "','" +
                             cbtipoiden.Text + "','" +
                             mtnoiden.Text + "','" +
                             dtpfechanaci.Value.ToString("yyyy-MM-dd") + "','" +
                             txdireccion.Text + "','" +
                             mttelefono.Text + "','" +
                             txfamiliar.Text + "','" +
                             mtmatricula.Text + "','" +
                             txcarrera.Text + "'";

                conexionesdb conex = new conexionesdb();
                conex.conectar(sql);
                MessageBox.Show("Datos Guardados Correctamente");
                limpiar();
            }
            else
            {
                MessageBox.Show("Algun Campo esta vacio, favor verificar");
            }
        }
Exemplo n.º 3
0
        private void btmodificar_Click(object sender, EventArgs e)
        {
            if
            (txnombre.Text != "" && txapellido1.Text != "" && txfamiliar.Text != "" && txcarrera.Text != "" && txdireccion.Text != "" &&
             cbtipoiden.Text != "" && mtnoiden.Text != "" && mttelefono.Text != "" && mtmatricula.Text != "" &&
             rbm.Checked == true || rbf.Checked)

            {
                string genero = "";
                if (rbm.Checked == true)
                {
                    genero = "M";
                }
                else
                {
                    genero = "F";
                }

                string sql = "update estudiantes set " +
                             "Nombre='" + txnombre.Text + "'," +
                             "Apellidos='" + txapellido1.Text + "'," +
                             "Genero='" + genero + "'," +
                             "TipodeIdentificacion='" + cbtipoiden.Text + "'," +
                             "NoIdentificacion ='" + mtnoiden.Text + "'," +
                             "Fechanaci='" + dtpfechanaci.Value.ToString("yyyy-MM-dd") + "'," +
                             "Direccion='" + txdireccion.Text + "'," +
                             "Telefono='" + mttelefono.Text + "'," +
                             "familiar='" + txfamiliar.Text + "'," +
                             "Carrera='" + txcarrera.Text + "" + "' where Matricula = '" + mtmatricula.Text + "'";


                conexionesdb conex = new conexionesdb();
                conex.conectar(sql);
                MessageBox.Show("Datos Guardados Correctamente");
            }
            else
            {
                MessageBox.Show("Algun Campo esta vacio, favor verificar");
            }
        }