private void Button2_Click(object sender, EventArgs e) { if (editar) { con.Conectar(); String consulta = "update people set Cedula = '" + txtCedula.Text + "', Nombre ='" + txtName.Text + "' , Apellido = '" + txtLastName.Text + "', Correo ='" + txtEmail.Text + "', Celular = '" + txtPhone.Text + "', Direccion = '" + txtAddress.Text + "' where id = " + Id + ";"; con.EjecSql(consulta); this.ActualizarGrid(); LimpiarCeladas(); con.Desconectar(); editar = false; } else { con.Conectar(); String consulta = "insert into people (Cedula, Nombre, Apellido, Correo, Celular, Direccion) values ('" + txtCedula.Text + "','" + txtName.Text + "' ,'" + txtLastName.Text + "', '" + txtEmail.Text + "', '" + txtPhone.Text + "', '" + txtAddress.Text + "')"; con.EjecSql(consulta); this.ActualizarGrid(); LimpiarCeladas(); con.Desconectar(); } }