private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_nombre.Text == "") { MessageBox.Show("El Nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (cbx_pais.Text == "") { MessageBox.Show("El pais No Puede Ir en Blanco"); cbx_pais.Select(); cbx_pais.Focus(); } else { string sql = "insert into pr_provincias (nombre, pais) values ('" + this.txt_nombre.Text + "','" + this.cbx_pais.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); this.Close(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } }
private void rango_alquiler_Load(object sender, EventArgs e) { crud obcrud = new crud(); this.cbx_fiscalia.DataSource = obcrud.consultar3("pr_clientes", "hidden= 0"); this.cbx_fiscalia.DisplayMember = "nombre"; this.cbx_fiscalia.ValueMember = "nombre"; this.cbx_fiscalia.Refresh(); }
private void frm_add_sector_Load(object sender, EventArgs e) { crud obcrud = new crud(); this.cbx_provincias.DataSource = obcrud.consultar3("pr_provincias", "hidden= 0"); this.cbx_provincias.DisplayMember = "nombre"; this.cbx_provincias.ValueMember = "nombre"; this.cbx_provincias.Refresh(); }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_nombre.Text == "") { MessageBox.Show("El Nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_direccion.Text == "") { MessageBox.Show("La Direccion No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { if (txt_fiscal.Text == "") { MessageBox.Show("El Fiscal No Puede Ir en Blanco"); txt_fiscal.Select(); txt_fiscal.Focus(); } else { if (cbx_pais.Text == "") { MessageBox.Show("El Pais No Puede Ir en Blanco"); cbx_pais.Select(); cbx_pais.Focus(); } else { string sql = "insert into pr_fiscalia(nombre, direccion, pais, fiscal) values ('" + this.txt_nombre.Text + "','" + this.txt_direccion.Text + "','" + this.cbx_pais.Text + "','" + this.txt_fiscal.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); mtb_cedula.Select(); mtb_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { if (txt_telefono.Text == "") { MessageBox.Show("El Telefono No Puede Ir en Blanco"); txt_telefono.Select(); txt_telefono.Focus(); } else { string sql = "insert into pr_jueces(cedula, nombre, apellido, email, jurisdiccion, telefono, celular, juzgado, fizcalia, genero, estado_civil) values ('" + this.mtb_cedula.Text + "','" + this.txt_nombre.Text + "','" + this.txt_apellido.Text + "','" + this.txt_email.Text + "','" + this.cbx_jurisdiccion.Text + "','" + this.txt_telefono.Text + "','" + this.txt_celular.Text + "','" + this.cbx_juzgado.Text + "','" + this.cbx_fiscalia.Text + "','" + this.cbx_genero.Text + "','" + this.cbx_estado.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } } }
private void btn_modificar_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); mtb_cedula.Select(); mtb_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { if (txt_telefono.Text == "") { MessageBox.Show("El Telefono No Puede Ir en Blanco"); txt_telefono.Select(); txt_telefono.Focus(); } else { string campos = "nombre ='" + this.txt_nombre.Text + "',apellido ='" + this.txt_apellido.Text + "',email ='" + this.txt_email.Text + "',jurisdiccion ='" + this.cbx_jurisdiccion.Text + "',telefono ='" + this.txt_telefono.Text + "',celular ='" + this.txt_celular.Text + "',juzgado ='" + this.cbx_juzgado.Text + "',fizcalia ='" + this.cbx_fiscalia.Text + "',genero ='" + this.cbx_genero.Text + "',estado_civil ='" + this.cbx_estado.Text + "'"; if (obcrud.actualizar("pr_jueces", campos, "cedula = '" + this.mtb_cedula.Text + "'")) { MessageBox.Show("Se a Actualizado Correctamente"); } else { MessageBox.Show("no se pudo actualizar"); } } } } } }
private void frm_jueces_Load(object sender, EventArgs e) { crud obcrud = new crud(); this.cbx_fiscalia.DataSource = obcrud.consultar3("pr_fiscalia", "hidden= 0"); this.cbx_fiscalia.DisplayMember = "nombre"; this.cbx_fiscalia.ValueMember = "nombre"; this.cbx_fiscalia.Refresh(); this.cbx_juzgado.DataSource = obcrud.consultar3("pr_juzgado_paz", "hidden= 0"); this.cbx_juzgado.DisplayMember = "circunscripcion"; this.cbx_juzgado.ValueMember = "circunscripcion"; this.cbx_juzgado.Refresh(); mtb_buscador.Select(); this.mtb_cedula.Enabled = false; this.txt_nombre.Enabled = false; this.txt_apellido.Enabled = false; this.txt_email.Enabled = false; this.cbx_jurisdiccion.Enabled = false; this.txt_telefono.Enabled = false; this.txt_celular.Enabled = false; this.cbx_juzgado.Enabled = false; this.cbx_fiscalia.Enabled = false; this.cbx_genero.Enabled = false; this.cbx_estado.Enabled = false; MySqlConnection cn; MySqlCommand cmd; MySqlDataReader dr; try { cn = new MySqlConnection("server=localhost;user id=root; database=proyecto3; password="******"select nombre, apellido, cedula, telefono, fizcalia, juzgado, jurisdiccion from pr_jueces where hidden =0", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { this.dataGridView1.Rows.Add(dr.GetValue(0), dr.GetValue(1), dr.GetValue(2), dr.GetValue(3), dr.GetValue(4), dr.GetValue(5), dr.GetValue(6)); } cn.Close(); } catch (Exception ex) { MessageBox.Show("Error" + ex.Message); } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_circuns.Text == "") { MessageBox.Show("El Nombre No Puede Ir en Blanco"); txt_circuns.Select(); txt_circuns.Focus(); } else { if (txt_direccion.Text == "") { MessageBox.Show("La Direccion No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { if (txt_abogado.Text == "") { MessageBox.Show("El Fiscal No Puede Ir en Blanco"); txt_abogado.Select(); txt_abogado.Focus(); } else { string sql = "insert into pr_juzgado_paz(circunscripcion, direccion, pais, juez) values ('" + this.txt_circuns.Text + "','" + this.txt_direccion.Text + "','" + this.cbx_pais.Text + "','" + this.txt_abogado.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); this.Close(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_costo.Text == "") { MessageBox.Show("El Costo No Puede Ir en Blanco"); txt_costo.Select(); txt_costo.Focus(); } else { if (txt_abonos.Text == "") { MessageBox.Show("Los Abonos No Puede Ir en Blanco"); txt_abonos.Select(); txt_abonos.Focus(); } else { if (txt_impuesto.Text == "") { MessageBox.Show("El impuesto No Puede Ir en Blanco"); txt_impuesto.Select(); txt_impuesto.Focus(); } else { string sql = "insert into pr_divorcios(cliente, abogado, juez, procurador, razon, costo, abonos, impuestos, notas, date) values ('" + this.cbx_cliente.Text + "','" + this.cbx_abogado.Text + "','" + this.cbx_juez.Text + "','" + this.cbx_procurador.Text + "','" + this.cbx_razon.Text + "','" + this.txt_costo.Text + "','" + this.txt_abonos.Text + "','" + this.txt_impuesto.Text + "','" + this.richTextBox1.Text + "','" + this.dtp_contrato.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } }
private void btn_nuevo_Click_1(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); txt_cedula.Select(); txt_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { string sql = "insert into pr_procurador (cedula, nombre, apellido, genero, tipo_procurador, procu_id) values ('" + this.txt_cedula.Text + "','" + this.txt_nombre.Text + "','" + this.txt_apellido.Text + "','" + this.cbx_genero.Text + "','" + this.cbx_procu_type.Text + "','" + this.cbx_procuraduria.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } }
private void btn_eliminar_Click(object sender, EventArgs e) { object celda; crud obcrud = new crud(); celda = dataGridView2.CurrentCell.Value; string condicion = "nombre='" + celda + "'"; if (obcrud.actualizar("pr_terceros", "hidden = 1", condicion)) { dataGridView2.Refresh(); int fill = dataGridView2.CurrentRow.Index; dataGridView2.Rows.RemoveAt(fill); } else { MessageBox.Show("No Se ha Podido Eliminar, correctamente. Debe seleccionar el nombre y luego darle a Eliminar."); } }
private void btn_modificar_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_costo.Text == "") { MessageBox.Show("El Costo No Puede Ir en Blanco"); txt_costo.Select(); txt_costo.Focus(); } else { if (txt_abonos.Text == "") { MessageBox.Show("Los Abonos No Puede Ir en Blanco"); txt_abonos.Select(); txt_abonos.Focus(); } else { if (txt_impuesto.Text == "") { MessageBox.Show("El impuesto No Puede Ir en Blanco"); txt_impuesto.Select(); txt_impuesto.Focus(); } else { string campos = "cliente ='" + this.cbx_cliente.Text + "',abogado ='" + this.cbx_abogado.Text + "',juez ='" + this.cbx_juez.Text + "',procurador ='" + this.cbx_procurador.Text + "',razon ='" + this.cbx_razon.Text + "',costo ='" + this.txt_costo.Text + "',impuesto ='" + this.txt_impuesto.Text + "',abonos ='" + this.txt_abonos.Text + "',notas ='" + this.richTextBox1.Text + "'"; if (obcrud.actualizar("pr_divorcios", campos, "cliente = '" + this.cbx_cliente.Text + "'")) { MessageBox.Show("Se a Actualizado Correctamente"); } else { MessageBox.Show("no se pudo actualizar"); } } } } }
private void btn_modificar_Click_1(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); txt_cedula.Select(); txt_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { string campos = "nombre ='" + this.txt_nombre.Text + "',apellido ='" + this.txt_apellido.Text + "',genero ='" + this.cbx_genero.Text + "',tipo_procurador ='" + this.cbx_procu_type.Text + "',procu_id ='" + this.cbx_procuraduria.Text + "'"; if (obcrud.actualizar("pr_procurador", campos, "cedula = '" + this.txt_cedula.Text + "'")) { MessageBox.Show("Se a Actualizado Correctamente"); } else { MessageBox.Show("no se pudo actualizar"); } } } } }
private void button5_Click(object sender, EventArgs e) { crud obcrud = new crud(); object celda = dataGridView2.CurrentCell.Value; string campos = "cambio ='" + this.textBox1.Text + "'"; if (obcrud.actualizar("pr_facturacion", campos, "id = '" + celda + "'")) { MessageBox.Show("Se a Actualizado Correctamente"); dataGridView2.Rows.Clear(); MySqlConnection cn; MySqlCommand cmd; MySqlDataReader dr; try { cn = new MySqlConnection("server=localhost;user id=root; database=proyecto3; password="******"select id, nombre, apellido, sub_total, honorarios, itbs, notario, total, efectivo, cambio from pr_facturacion where cambio <= '0'", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { this.dataGridView2.Rows.Add(dr.GetValue(0), dr.GetValue(1), dr.GetValue(2), dr.GetValue(3), dr.GetValue(4), dr.GetValue(5), dr.GetValue(6), dr.GetValue(7), dr.GetValue(8), dr.GetValue(9)); } cn.Close(); } catch (Exception ex) { MessageBox.Show("Error" + ex.Message); } } else { MessageBox.Show("no se pudo actualizar"); } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); mtb_cedula.Select(); mtb_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { if (txt_telefono.Text == "") { MessageBox.Show("El Telefono No Puede Ir en Blanco"); txt_telefono.Select(); txt_telefono.Focus(); } else { if (txt_direccion.Text == "") { MessageBox.Show("La Direccion No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { { if (txt_trabajo.Text == "") { MessageBox.Show("El Trabajo a Realizar No Puede Ir en Blanco"); txt_trabajo.Select(); txt_trabajo.Focus(); } else { string sql = "insert into pr_terceros(cedula, nombre, apellido, apodo, email, contacto, telefono, celular, trabajo_realizar, direccion, costo_servicio, empresa, abonos, direccion_trabajo, fizcalia, genero, estado_civil, pais) values ('" + this.mtb_cedula.Text + "','" + this.txt_nombre.Text + "','" + this.txt_apellido.Text + "','" + this.txt_apodo.Text + "','" + this.txt_email.Text + "','" + this.txt_contacto.Text + "','" + this.txt_telefono.Text + "','" + this.txt_celular.Text + "','" + this.txt_trabajo.Text + "','" + this.txt_direccion.Text + "','" + this.txt_costo.Text + "','" + this.txt_empresa.Text + "','" + this.txt_abonos.Text + "','" + this.txt_direc_emp.Text + "','" + this.txt_fizcalia.Text + "','" + this.cbx_genero.Text + "','" + this.cbx_estado.Text + "','" + this.cbx_pais.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } } } } } }
private void button5_Click(object sender, EventArgs e) { string cliente = ""; string apellido = ""; string id = tipo; object celda = cell; string data = datos; string campo = ""; string campo2 = ""; switch (id) { case "1": campo = "a.cedula"; campo2 = "cedula_c"; break; case "2": campo = "a.cedula"; campo2 = "cedula_c"; break; case "3": campo = "a.nombre"; campo2 = "nombre_c"; break; case "4": campo = "a.apellido"; campo2 = "apellido_c"; break; } string cadsql5 = "SELECT a.nombre, a.apellido FROM pr_clientes AS a INNER JOIN pr_gastos AS b ON a.client_Id = b.client_Id where " + campo + "='" + data + "' and b.tipo='" + celda + "'"; MySqlCommand com5 = new MySqlCommand(cadsql5, con); con.Open(); MySqlDataReader leer5 = com5.ExecuteReader(); if (leer5.Read() == true) { cliente = leer5[0].ToString(); apellido = leer5[1].ToString(); con.Close(); } con.Close(); crud obcrud = new crud(); string sql = "insert into pr_facturacion(nombre, apellido, sub_total, honorarios, itbs, notario, total, efectivo, cambio) values ('" + cliente + "','" + apellido + "','" + this.txt_sub_total.Text + "','" + this.textBox6.Text + "','" + this.textBox1.Text + "','" + this.textBox7.Text + "','" + this.textBox7.Text + "','" + this.textBox4.Text + "','" + this.textBox2.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Gracias por realizar el pago"); } else { MessageBox.Show("No Se ha Podido insertar"); } this.Close(); }
private void button5_Click(object sender, EventArgs e) { string cliente= ""; string apellido=""; string id = tipo; object celda = cell; string data = datos; string campo = ""; string campo2 = ""; switch (id) { case "1": campo = "a.cedula"; campo2 = "cedula_c"; break; case "2": campo = "a.cedula"; campo2 = "cedula_c"; break; case "3": campo = "a.nombre"; campo2 = "nombre_c"; break; case "4": campo = "a.apellido"; campo2 = "apellido_c"; break; } string cadsql5 = "SELECT a.nombre, a.apellido FROM pr_clientes AS a INNER JOIN pr_gastos AS b ON a.client_Id = b.client_Id where " + campo + "='" + data + "' and b.tipo='" + celda + "'"; MySqlCommand com5 = new MySqlCommand(cadsql5, con); con.Open(); MySqlDataReader leer5 = com5.ExecuteReader(); if (leer5.Read() == true) { cliente = leer5[0].ToString(); apellido = leer5[1].ToString(); con.Close(); } con.Close(); crud obcrud = new crud(); string sql = "insert into pr_facturacion(nombre, apellido, sub_total, honorarios, itbs, notario, total, efectivo, cambio) values ('" + cliente + "','" + apellido + "','" + this.txt_sub_total.Text + "','" + this.textBox6.Text + "','" + this.textBox1.Text + "','" + this.textBox7.Text + "','" + this.textBox7.Text + "','" + this.textBox4.Text + "','" + this.textBox2.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Gracias por realizar el pago"); } else { MessageBox.Show("No Se ha Podido insertar"); } this.Close(); }
private void btn_eliminar_Click_1(object sender, EventArgs e) { object celda; crud obcrud = new crud(); celda = dataGridView2.CurrentCell.Value; string condicion = "nombre='" + celda + "'"; if (obcrud.actualizar("pr_procurador", "hidden = 1", condicion)) { dataGridView2.Refresh(); int fill = dataGridView2.CurrentRow.Index; dataGridView2.Rows.RemoveAt(fill); } else { MessageBox.Show("No Se ha Podido Eliminar, correctamente. Debe seleccionar el nombre y luego darle a Eliminar."); } }
private void btn_modificar_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); mtb_cedula.Select(); mtb_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { if (txt_telefono.Text == "") { MessageBox.Show("El Telefono No Puede Ir en Blanco"); txt_telefono.Select(); txt_telefono.Focus(); } else { if (txt_direccion.Text == "") { MessageBox.Show("La Direccion No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { { if (txt_trabajo.Text == "") { MessageBox.Show("El Trabajo a Realizar No Puede Ir en Blanco"); txt_trabajo.Select(); txt_trabajo.Focus(); } else { string campos = "nombre ='" + this.txt_nombre.Text + "',apellido ='" + this.txt_apellido.Text + "',apodo ='" + this.txt_apodo.Text + "',email ='" + this.txt_email.Text + "',contacto ='" + this.txt_contacto.Text + "',telefono ='" + this.txt_telefono.Text + "',celular ='" + this.txt_celular.Text + "',trabajo_realizar ='" + this.txt_trabajo.Text + "',direccion ='" + this.txt_direccion.Text + "',costo_servicio ='" + this.txt_costo.Text + "',empresa ='" + this.txt_empresa.Text + "',abonos ='" + this.txt_abonos.Text + "',direccion_trabajo ='" + this.txt_direc_emp.Text + "',fizcalia ='" + this.cbx_fiscalia.Text + "',genero ='" + this.cbx_genero.Text + "',estado_civil ='" + this.cbx_estado.Text + "',pais ='" + this.cbx_pais.Text + "',tel_trabajo ='" + this.txt_tel_emp.Text + "', sector ='" + this.cbx_sector.Text + "',provincia ='" + this.cbx_provincia.Text + "',procurador ='" + this.cbx_procurador.Text + "',oficialia_civil ='" + this.cbx_oficialia.Text + "'"; if (obcrud.actualizar("pr_clientes", campos, "cedula = '" + this.mtb_cedula.Text + "'")) { MessageBox.Show("Se a Actualizado Correctamente"); } else { MessageBox.Show("no se pudo actualizar"); } } } } } } } } }
private void btn_modificar_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); mtb_cedula.Select(); mtb_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { if (txt_telefono.Text == "") { MessageBox.Show("El Telefono No Puede Ir en Blanco"); txt_telefono.Select(); txt_telefono.Focus(); } else { if (txt_direccion.Text == "") { MessageBox.Show("La Direccion No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { { if (txt_trabajo.Text == "") { MessageBox.Show("El Trabajo a Realizar No Puede Ir en Blanco"); txt_trabajo.Select(); txt_trabajo.Focus(); } else { string campos = "nombre ='" + this.txt_nombre.Text + "',apellido ='" + this.txt_apellido.Text + "',apodo ='" + this.txt_apodo.Text + "',email ='" + this.txt_email.Text + "',contacto ='" + this.txt_contacto.Text + "',telefono ='" + this.txt_telefono.Text + "',celular ='" + this.txt_celular.Text + "',trabajo_realizar ='" + this.txt_trabajo.Text + "',direccion ='" + this.txt_direccion.Text + "',costo_servicio ='" + this.txt_costo.Text + "',empresa ='" + this.txt_empresa.Text + "',abonos ='" + this.txt_abonos.Text + "',direccion_trabajo ='" + this.txt_direc_emp.Text + "',fizcalia ='" + this.txt_fizcalia.Text + "',genero ='" + this.cbx_genero.Text + "',estado_civil ='" + this.cbx_estado.Text + "',pais ='" + this.cbx_pais.Text + "'"; if (obcrud.actualizar("pr_terceros", campos, "cedula = '" + this.mtb_cedula.Text + "'")) { MessageBox.Show("Se a Actualizado Correctamente"); } else { MessageBox.Show("no se pudo actualizar"); } } } } } } } } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula_c.Text == "") { MessageBox.Show("La Cedula del cliente No Puede Ir en Blanco"); mtb_cedula_c.Select(); mtb_cedula_c.Focus(); } else { if (comboBox1.Text == "") { MessageBox.Show("El nombre del cliente No Puede Ir en Blanco"); comboBox1.Select(); comboBox1.Focus(); } else { if (txt_apellido_c.Text == "") { MessageBox.Show("El Apellido del cliente No Puede Ir en Blanco"); txt_apellido_c.Select(); txt_apellido_c.Focus(); } else { if (cbx_genero_c.Text == "") { MessageBox.Show("El genero del cliente No Puede Ir en Blanco"); cbx_genero_c.Select(); cbx_genero_c.Focus(); } else { if (txt_direccion_c.Text == "") { MessageBox.Show("La Direccion del cliente No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { if (txt_tel_c.Text == "") { MessageBox.Show("El Trabajo del cliente a Realizar No Puede Ir en Blanco"); txt_tel_c.Select(); txt_tel_c.Focus(); } else { if (txt_celular_c.Text == "") { MessageBox.Show("El Celular del cliente No Puede Ir en Blanco"); txt_celular_c.Select(); txt_celular_c.Focus(); } else { if (cbx_estado_civil_c.Text == "") { MessageBox.Show("El Estado Civil No Puede Ir en Blanco"); cbx_estado_civil_c.Select(); cbx_estado_civil_c.Focus(); } else { if (mtb_cedula_i.Text == "") { MessageBox.Show("La Cedula del inquilino No Puede Ir en Blanco"); mtb_cedula_i.Select(); mtb_cedula_i.Focus(); } else { if (comboBox2.Text == "") { MessageBox.Show("El nombre del inquilino No Puede Ir en Blanco"); comboBox2.Select(); comboBox2.Focus(); } else { if (txt_apellido_i.Text == "") { MessageBox.Show("El Apellido del inquilino No Puede Ir en Blanco"); txt_apellido_i.Select(); txt_apellido_i.Focus(); } else { if (cbx_genero_i.Text == "") { MessageBox.Show("El genero del inquilino No Puede Ir en Blanco"); cbx_genero_i.Select(); cbx_genero_i.Focus(); } else { if (txt_direccion_i.Text == "") { MessageBox.Show("La Direccion del inquilino No Puede Ir en Blanco"); txt_direccion_i.Select(); txt_direccion_i.Focus(); } else { if (txt_tel_i.Text == "") { MessageBox.Show("El Trabajo del inquilino a Realizar No Puede Ir en Blanco"); txt_tel_i.Select(); txt_tel_i.Focus(); } else { if (txt_celular_i.Text == "") { MessageBox.Show("El Celular del inquilino No Puede Ir en Blanco"); txt_celular_i.Select(); txt_celular_i.Focus(); } else { if (cbx_estado_civil_i.Text == "") { MessageBox.Show("El Estado Civil del inquilino No Puede Ir en Blanco"); cbx_estado_civil_i.Select(); cbx_estado_civil_i.Focus(); } else { if (mtb_cedula_g.Text == "") { MessageBox.Show("La Cedula del garante No Puede Ir en Blanco"); mtb_cedula_g.Select(); mtb_cedula_g.Focus(); } else { if (comboBox3.Text == "") { MessageBox.Show("El nombre del garante No Puede Ir en Blanco"); comboBox3.Select(); comboBox3.Focus(); } else { if (txt_apellido_g.Text == "") { MessageBox.Show("El Apellido del garante No Puede Ir en Blanco"); txt_apellido_g.Select(); txt_apellido_g.Focus(); } else { if (cbx_genero_g.Text == "") { MessageBox.Show("El genero del garante No Puede Ir en Blanco"); cbx_genero_g.Select(); cbx_genero_g.Focus(); } else { if (txt_direccion_g.Text == "") { MessageBox.Show("La Direccion del garante No Puede Ir en Blanco"); txt_direccion_g.Select(); txt_direccion_g.Focus(); } else { if (txt_tel_g.Text == "") { MessageBox.Show("El Trabajo del garante a Realizar No Puede Ir en Blanco"); txt_tel_g.Select(); txt_tel_g.Focus(); } else { if (txt_celular_g.Text == "") { MessageBox.Show("El Celular del garante No Puede Ir en Blanco"); txt_celular_g.Select(); txt_celular_g.Focus(); } else { if (cbx_estado_civil_g.Text == "") { MessageBox.Show("El Estado Civil del garante No Puede Ir en Blanco"); cbx_estado_civil_g.Select(); cbx_estado_civil_g.Focus(); } else { string sql = "insert into pr_alquiler(cedula_c, nombre_c, apellido_c, genero_c, telefono_c, celular_c, direccion_c, estado_civil_c, cedula_i, nombre_i, apellido_i, genero_i, telefono_i, celular_i, direccion_i, estado_civil_i, cedula_g, nombre_g, apellido_g, genero_g, telefono_g, celular_g, direccion_g, estado_civil_g, direccion, actual, contrato, alquiler, deposito, vigencia, servicio_total, servicio_mensual, notario ) values ('" + this.mtb_cedula_c.Text + "','" + this.comboBox1.Text + "', '" + this.txt_apellido_c.Text + "','" + this.cbx_genero_c.Text + "','" + this.txt_tel_c.Text + "','" + this.txt_celular_c.Text + "','" + this.txt_direccion.Text + "','" + this.cbx_estado_civil_c.Text + "','" + this.mtb_cedula_i.Text + "','" + this.comboBox2.Text + "','" + this.txt_apellido_i.Text + "','" + this.cbx_genero_i.Text + "','" + this.txt_tel_i.Text + "','" + this.txt_celular_i.Text + "','" + this.txt_direccion_i.Text + "','" + this.cbx_estado_civil_i.Text + "','" + this.mtb_cedula_g.Text + "','" + this.comboBox3.Text + "','" + this.txt_apellido_g.Text + "','" + this.cbx_genero_g.Text + "','" + this.txt_tel_g.Text + "','" + this.txt_celular_g.Text + "','" + this.txt_direccion_g.Text + "','" + this.cbx_estado_civil_g.Text + "','" + this.txt_direccion.Text + "','" + this.dtp_actual.Text + "','" + this.dtp_contrato.Text + "','" + this.txt_alquiler.Text + "','" + this.txt_deposito.Text + "','" + this.cbx_vigencia.Text + "','" + this.txt_servicio_local.Text + "','" + this.txt_servicio_mensual.Text + "','" + this.txt_notario.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } } } } } } } } } } } } } } } } } } } } } } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula_c.Text == "") { MessageBox.Show("La Cedula del cliente No Puede Ir en Blanco"); mtb_cedula_c.Select(); mtb_cedula_c.Focus(); } else { if (txt_nombre_c.Text == "") { MessageBox.Show("El nombre del cliente No Puede Ir en Blanco"); txt_nombre_c.Select(); txt_nombre_c.Focus(); } else { if (txt_apellido_c.Text == "") { MessageBox.Show("El Apellido del cliente No Puede Ir en Blanco"); txt_apellido_c.Select(); txt_apellido_c.Focus(); } else { if (cbx_genero_c.Text == "") { MessageBox.Show("El genero del cliente No Puede Ir en Blanco"); cbx_genero_c.Select(); cbx_genero_c.Focus(); } else { if (txt_direccion_c.Text == "") { MessageBox.Show("La Direccion del cliente No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { if (txt_tel_c.Text == "") { MessageBox.Show("El Trabajo del cliente a Realizar No Puede Ir en Blanco"); txt_tel_c.Select(); txt_tel_c.Focus(); } else { if (txt_celular_c.Text == "") { MessageBox.Show("El Celular del cliente No Puede Ir en Blanco"); txt_celular_c.Select(); txt_celular_c.Focus(); } else { if (cbx_estado_civil_c.Text == "") { MessageBox.Show("El Estado Civil No Puede Ir en Blanco"); cbx_estado_civil_c.Select(); cbx_estado_civil_c.Focus(); } else { if (mtb_cedula_i.Text == "") { MessageBox.Show("La Cedula del inquilino No Puede Ir en Blanco"); mtb_cedula_i.Select(); mtb_cedula_i.Focus(); } else { if (txt_nombre_i.Text == "") { MessageBox.Show("El nombre del inquilino No Puede Ir en Blanco"); txt_nombre_i.Select(); txt_nombre_i.Focus(); } else { if (txt_apellido_i.Text == "") { MessageBox.Show("El Apellido del inquilino No Puede Ir en Blanco"); txt_apellido_i.Select(); txt_apellido_i.Focus(); } else { if (cbx_genero_i.Text == "") { MessageBox.Show("El genero del inquilino No Puede Ir en Blanco"); cbx_genero_i.Select(); cbx_genero_i.Focus(); } else { if (txt_direccion_i.Text == "") { MessageBox.Show("La Direccion del inquilino No Puede Ir en Blanco"); txt_direccion_i.Select(); txt_direccion_i.Focus(); } else { if (txt_tel_i.Text == "") { MessageBox.Show("El Trabajo del inquilino a Realizar No Puede Ir en Blanco"); txt_tel_i.Select(); txt_tel_i.Focus(); } else { if (txt_celular_i.Text == "") { MessageBox.Show("El Celular del inquilino No Puede Ir en Blanco"); txt_celular_i.Select(); txt_celular_i.Focus(); } else { if (cbx_estado_civil_i.Text == "") { MessageBox.Show("El Estado Civil del inquilino No Puede Ir en Blanco"); cbx_estado_civil_i.Select(); cbx_estado_civil_i.Focus(); } else { if (mtb_cedula_g.Text == "") { MessageBox.Show("La Cedula del garante No Puede Ir en Blanco"); mtb_cedula_g.Select(); mtb_cedula_g.Focus(); } else { if (txt_nombre_g.Text == "") { MessageBox.Show("El nombre del garante No Puede Ir en Blanco"); txt_nombre_g.Select(); txt_nombre_g.Focus(); } else { if (txt_apellido_g.Text == "") { MessageBox.Show("El Apellido del garante No Puede Ir en Blanco"); txt_apellido_g.Select(); txt_apellido_g.Focus(); } else { if (cbx_genero_g.Text == "") { MessageBox.Show("El genero del garante No Puede Ir en Blanco"); cbx_genero_g.Select(); cbx_genero_g.Focus(); } else { if (txt_direccion_g.Text == "") { MessageBox.Show("La Direccion del garante No Puede Ir en Blanco"); txt_direccion_g.Select(); txt_direccion_g.Focus(); } else { if (txt_tel_g.Text == "") { MessageBox.Show("El Trabajo del garante a Realizar No Puede Ir en Blanco"); txt_tel_g.Select(); txt_tel_g.Focus(); } else { if (txt_celular_g.Text == "") { MessageBox.Show("El Celular del garante No Puede Ir en Blanco"); txt_celular_g.Select(); txt_celular_g.Focus(); } else { if (cbx_estado_civil_g.Text == "") { MessageBox.Show("El Estado Civil del garante No Puede Ir en Blanco"); cbx_estado_civil_g.Select(); cbx_estado_civil_g.Focus(); } else { string sql = "insert into pr_venta(cedula_c, nombre_c, apellido_c, genero_c, telefono_c, celular_c, direccion_c, estado_civil_c, cedula_i, nombre_i, apellido_i, genero_i, telefono_i, celular_i, direccion_i, estado_civil_i, cedula_g, nombre_g, apellido_g, genero_g, telefono_g, celular_g, direccion_g, estado_civil_g, direccion, actual, contrato, objeto, monto, honorarios, gastos, longitud, descripcion ) values ('" + this.mtb_cedula_c.Text + "','" + this.txt_nombre_c.Text + "', '" + this.txt_apellido_c.Text + "','" + this.cbx_genero_c.Text + "','" + this.txt_tel_c.Text + "','" + this.txt_celular_c.Text + "','" + this.txt_direccion.Text + "','" + this.cbx_estado_civil_c.Text + "','" + this.mtb_cedula_i.Text + "','" + this.txt_nombre_i.Text + "','" + this.txt_apellido_i.Text + "','" + this.cbx_genero_i.Text + "','" + this.txt_tel_i.Text + "','" + this.txt_celular_i.Text + "','" + this.txt_direccion_i.Text + "','" + this.cbx_estado_civil_i.Text + "','" + this.mtb_cedula_g.Text + "','" + this.txt_nombre_g.Text + "','" + this.txt_apellido_g.Text + "','" + this.cbx_genero_g.Text + "','" + this.txt_tel_g.Text + "','" + this.txt_celular_g.Text + "','" + this.txt_direccion_g.Text + "','" + this.cbx_estado_civil_g.Text + "','" + this.txt_direccion.Text + "','" + this.dtp_actual.Text + "','" + this.dtp_contrato.Text + "','" + this.txt_alquiler.Text + "','" + this.txt_deposito.Text + "','" + this.cbx_vigencia.Text + "','" + this.txt_servicio_local.Text + "','" + this.txt_servicio_mensual.Text + "','" + this.txt_notario.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } } } } } } } } } } } } } } } } } } } } } } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (txt_costo.Text == "") { MessageBox.Show("El Costo No Puede Ir en Blanco"); txt_costo.Select(); txt_costo.Focus(); } else { if (txt_abonos.Text == "") { MessageBox.Show("Los Abonos No Puede Ir en Blanco"); txt_abonos.Select(); txt_abonos.Focus(); } else { if (txt_impuesto.Text == "") { MessageBox.Show("El impuesto No Puede Ir en Blanco"); txt_impuesto.Select(); txt_impuesto.Focus(); } else { string sql = "insert into pr_divorcios(cliente, abogado, juez, procurador, razon, costo, abonos, impuestos, notas, date) values ('" + this.cbx_cliente.Text + "','" + this.cbx_abogado.Text + "','" + this.cbx_juez.Text + "','" + this.cbx_procurador.Text+"','" + this.cbx_razon.Text + "','" + this.txt_costo.Text + "','" + this.txt_abonos.Text + "','" + this.txt_impuesto.Text + "','" + this.richTextBox1.Text + "','"+this.dtp_contrato.Text+"')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } }
private void frm_clientes_Load(object sender, EventArgs e) { crud obcrud = new crud(); this.cbx_fiscalia.DataSource = obcrud.consultar3("pr_fiscalia", "hidden= 0"); this.cbx_fiscalia.DisplayMember = "nombre"; this.cbx_fiscalia.ValueMember = "nombre"; this.cbx_fiscalia.Refresh(); this.cbx_procurador.DataSource = obcrud.consultar3("pr_procurador", "hidden= 0"); this.cbx_procurador.DisplayMember = "nombre"; this.cbx_procurador.ValueMember = "nombre"; this.cbx_procurador.Refresh(); this.cbx_provincia.DataSource = obcrud.consultar3("pr_provincias", "hidden= 0"); this.cbx_provincia.DisplayMember = "nombre"; this.cbx_provincia.ValueMember = "nombre"; this.cbx_provincia.Refresh(); this.cbx_sector.DataSource = obcrud.consultar3("pr_sectores", "hidden= 0"); this.cbx_sector.DisplayMember = "nombre"; this.cbx_sector.ValueMember = "nombre"; this.cbx_sector.Refresh(); this.cbx_oficialia.DataSource = obcrud.consultar3("pr_procuraduria", "hidden= 0"); this.cbx_oficialia.DisplayMember = "nombre"; this.cbx_oficialia.ValueMember = "nombre"; this.cbx_oficialia.Refresh(); mtb_buscador.Select(); this.mtb_pasaporte.Visible = false; this.btn_buscar.Visible = true; this.maskedTextBox1.Visible = false; this.label21.Visible = false; this.mtb_cedula.Enabled = false; this.txt_nombre.Enabled = false; this.txt_apellido.Enabled = false; this.txt_apodo.Enabled = false; this.txt_email.Enabled = false; this.txt_contacto.Enabled = false; this.txt_telefono.Enabled = false; this.txt_celular.Enabled = false; this.txt_trabajo.Enabled = false; this.txt_direccion.Enabled = false; this.txt_costo.Enabled = false; this.txt_empresa.Enabled = false; this.txt_tel_emp.Enabled = false; this.txt_costo.Enabled = false; this.txt_abonos.Enabled = false; this.txt_direc_emp.Enabled = false; this.cbx_fiscalia.Enabled = false; this.cbx_procurador.Enabled = false; this.cbx_sector.Enabled = false; this.cbx_provincia.Enabled = false; this.cbx_oficialia.Enabled = false; this.cbx_genero.Enabled = false; this.cbx_estado.Enabled = false; this.cbx_pais.Enabled = false; MySqlConnection cn; MySqlCommand cmd; MySqlDataReader dr; try { cn = new MySqlConnection("server=localhost;user id=root; database=proyecto3; password="******"select nombre, apellido, cedula, genero, telefono, direccion, trabajo_realizar, costo_servicio, fizcalia from pr_clientes where hidden=0", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { this.dataGridView1.Rows.Add(dr.GetValue(0), dr.GetValue(1), dr.GetValue(2), dr.GetValue(3), dr.GetValue(4), dr.GetValue(5), dr.GetValue(6), dr.GetValue(7), dr.GetValue(8)); } cn.Close(); } catch (Exception ex) { MessageBox.Show("Error" + ex.Message); } }
private void btn_nuevo_Click(object sender, EventArgs e) { crud obcrud = new crud(); if (mtb_cedula.Text == "") { MessageBox.Show("La Cedula No Puede Ir en Blanco"); mtb_cedula.Select(); mtb_cedula.Focus(); } else { if (txt_nombre.Text == "") { MessageBox.Show("El nombre No Puede Ir en Blanco"); txt_nombre.Select(); txt_nombre.Focus(); } else { if (txt_apellido.Text == "") { MessageBox.Show("El Apellido No Puede Ir en Blanco"); txt_apellido.Select(); txt_apellido.Focus(); } else { if (txt_telefono.Text == "") { MessageBox.Show("El Telefono No Puede Ir en Blanco"); txt_telefono.Select(); txt_telefono.Focus(); } else { if (txt_direccion.Text == "") { MessageBox.Show("La Direccion No Puede Ir en Blanco"); txt_direccion.Select(); txt_direccion.Focus(); } else { if (txt_trabajo.Text == "") { MessageBox.Show("El Trabajo a Realizar No Puede Ir en Blanco"); txt_trabajo.Select(); txt_trabajo.Focus(); } else { if (txt_costo.Text == "") { MessageBox.Show("El Costo No Puede Ir en Blanco"); txt_costo.Select(); txt_costo.Focus(); } else { if (cbx_genero.Text == "") { MessageBox.Show("El Genero No Puede Ir en Blanco"); cbx_genero.Select(); cbx_genero.Focus(); } else { if (cbx_estado.Text == "") { MessageBox.Show("El Estado Civil No Puede Ir en Blanco"); cbx_genero.Select(); cbx_genero.Focus(); } else { string sql = "insert into pr_clientes(cedula, nombre, apellido, apodo, email, contacto, telefono, celular, trabajo_realizar, direccion, costo_servicio, empresa, abonos, direccion_trabajo, fizcalia, genero, estado_civil, pais, tel_trabajo, sector, provincia, oficialia_civil, procurador) values ('" + this.mtb_cedula.Text + "','" + this.txt_nombre.Text + "','" + this.txt_apellido.Text + "','" + this.txt_apodo.Text + "','" + this.txt_email.Text + "','" + this.txt_contacto.Text + "','" + this.txt_telefono.Text + "','" + this.txt_celular.Text + "','" + this.txt_trabajo.Text + "','" + this.txt_direccion.Text + "','" + this.txt_costo.Text + "','" + this.txt_empresa.Text + "','" + this.txt_abonos.Text + "','" + this.txt_direc_emp.Text + "','" + this.cbx_fiscalia.Text + "','" + this.cbx_genero.Text + "','" + this.cbx_estado.Text + "','" + this.cbx_pais.Text + "','" + this.txt_tel_emp.Text + "','" + this.cbx_sector.Text + "','" + this.cbx_provincia.Text + "','" + this.cbx_procurador.Text + "','" + this.cbx_oficialia.Text + "')"; if (obcrud.insertar(sql)) { MessageBox.Show("Se ha agregado Correctamente"); dataGridView1.Refresh(); } else { MessageBox.Show("No Se ha Podido insertar"); } } } } } } } } } } }
private void frm_alquiler_Load(object sender, EventArgs e) { crud obcrud = new crud(); this.comboBox1.DataSource = obcrud.consultar3("pr_clientes", "hidden= 0"); this.comboBox1.DisplayMember = "nombre"; this.comboBox1.ValueMember = "nombre"; this.comboBox1.Refresh(); this.comboBox2.DataSource = obcrud.consultar3("pr_clientes", "hidden= 0"); this.comboBox2.DisplayMember = "nombre"; this.comboBox2.ValueMember = "nombre"; this.comboBox2.Refresh(); this.comboBox3.DataSource = obcrud.consultar3("pr_terceros", "hidden= 0"); this.comboBox3.DisplayMember = "nombre"; this.comboBox3.ValueMember = "nombre"; this.comboBox3.Refresh(); mtb_buscador.Select(); label1.Visible = true; label2.Visible = true; label16.Visible = true; label36.Visible = false; label37.Visible = false; label26.Visible = false; this.maskedTextBox1.Visible = false; this.maskedTextBox2.Visible = false; this.maskedTextBox3.Visible = false; this.mtb_cedula_c.Enabled = true; this.comboBox1.Enabled = false; this.txt_apellido_c.Enabled = false; this.cbx_genero_c.Enabled = false; this.txt_tel_c.Enabled = false; this.txt_celular_c.Enabled = false; this.txt_direccion_c.Enabled = false; this.cbx_estado_civil_c.Enabled = false; this.mtb_cedula_i.Enabled = true; this.comboBox2.Enabled = false; this.txt_apellido_i.Enabled = false; this.cbx_genero_i.Enabled = false; this.txt_tel_i.Enabled = false; this.txt_celular_i.Enabled = false; this.txt_direccion_i.Enabled = false; this.cbx_estado_civil_i.Enabled = false; this.mtb_cedula_g.Enabled = true; this.comboBox3.Enabled = false; this.txt_apellido_g.Enabled = false; this.cbx_genero_g.Enabled = false; this.txt_tel_g.Enabled = false; this.txt_celular_g.Enabled = false; this.txt_direccion_g.Enabled = false; this.cbx_estado_civil_g.Enabled = false; MySqlConnection cn; MySqlCommand cmd; MySqlDataReader dr; try { cn = new MySqlConnection("server=localhost;user id=root; database=proyecto3; password="******"select nombre_c, nombre_i, nombre_g, direccion, contrato, alquiler, notario from pr_alquiler where hidden=0", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { this.dataGridView1.Rows.Add(dr.GetValue(0), dr.GetValue(1), dr.GetValue(2), dr.GetValue(3), dr.GetValue(4), dr.GetValue(5), dr.GetValue(6)); } cn.Close(); } catch (Exception ex) { MessageBox.Show("Error" + ex.Message); } }