private void cargarDataGrid() { // Carga Datagridview con la tabla de estudiante Estudiante_bd ebd = new Estudiante_bd(); dataGridView1.DataSource = ebd.Select(); }
private void button4_Click(object sender, EventArgs e) { int id = Int32.Parse(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); Estudiante_bd ebd = new Estudiante_bd(); ebd.Delete(id); cargarDataGrid(); }
private void button2_Click(object sender, EventArgs e) { Estudiante est = new Estudiante(); est.id_estudiante = 1; est.nombre = "Pali2"; est.apellido = "Robles2"; est.direccion = "Purral2"; est.edad = 23; est.id_materia = 1; Estudiante_bd ebd = new Estudiante_bd(); ebd.Update(est); }
private void button1_Click(object sender, EventArgs e) { Estudiante est = new Estudiante(); est.id_estudiante = Int32.Parse(textBox1.Text); est.nombre = textBox2.Text; est.apellido = textBox3.Text; est.direccion = textBox4.Text; est.edad = Int32.Parse(textBox5.Text); est.id_materia = Int32.Parse(comboBox1.SelectedValue.ToString()); // Ese 1 debe de existir en la tabla de Materias y profesot hay que hacer uno... la relacion.. yo hice el insert a pie Estudiante_bd ebd = new Estudiante_bd(); ebd.Insert(est); cargarDataGrid(); Limpiar(); }