private void btnActualizar_Click(object sender, EventArgs e) { operation oper = new operation(); string id, nombre, apellidos, fecnac; id = txtId.Text; nombre = txtNombre.Text; apellidos = txtApellidos.Text; fecnac = dateTimePicker1.Value.Year.ToString() + "-" + dateTimePicker1.Value.Month.ToString() + "-" + dateTimePicker1.Value.Day.ToString(); oper.ExecuteNonQuery(" UPDATE cliente SET nombre='" + nombre + "' ,apellidos='" + apellidos + "',fecnac='" + fecnac + "' WHERE id='" + id + "'"); this.Close(); }
private void btnInsertar_Click(object sender, EventArgs e) { operation oper = new operation(); string id, nombre, apellidos, fecnac; id = txtId.Text; nombre = txtNombre.Text; apellidos = txtApellidos.Text; fecnac = dateTimePicker1.Value.Year.ToString() + "-" + dateTimePicker1.Value.Month.ToString() + "-" + dateTimePicker1.Value.Day.ToString(); oper.ExecuteNonQuery(" INSERT INTO cliente(nombre,apellidos,fecha)VALUES('" + nombre + "','" + apellidos + "','" + fecnac + "');"); this.Close(); }
private void button2_Click(object sender, EventArgs e) { operation oper = new operation(); DataTable dt = oper.ExtraeData(" SELECT * FROM cliente; "); dataGridView1.DataSource = dt; dataGridView1.Refresh(); //foreach (DataRow fila in dt.Rows) //{ // txtNombre.Text = fila["nombre"].ToString(); //} }