Greetings, I have a datagridview with an edit button. When you press to edit, the button brings all the data from the database to the form called Update.
With the text fields it is simple. I was able to do the conversion in this way:
private void dgv_buscar_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex !=1)
{
if (dgv_buscar.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Equals("editar"))
{
var registro = new Clases.Registro();
var cedula = dgv_buscar.Rows[e.RowIndex].Cells[3].Value.ToString();
var tabla = registro.BUSCARCEDULA(cedula);
var f = new Actualizar();
f.Show();
if (tabla.Rows.Count==1)
{
Actualizar.Myform.txtNombre.Text = tabla.Rows[0]["NOMBRE"].ToString();
Actualizar.Myform.txtApellido.Text = tabla.Rows[0]["APELLIDO"].ToString();
Actualizar.Myform.txtCedula.Text = tabla.Rows[0]["CEDULA"].ToString();
Actualizar.Myform.txtDireccion.Text = tabla.Rows[0]["DIRECCION"].ToString();
Actualizar.Myform.txtTelefono.Text = tabla.Rows[0]["TELEFONO"].ToString();
Actualizar.Myform.txtCelular.Text = tabla.Rows[0]["CELULAR"].ToString();
Actualizar.Myform.txtconversion.Text= tabla.Rows[0]["FCONVERSION"].ToString();
Actualizar.Myform.txtbautismo.Text = tabla.Rows[0]["FBAUTISMO"].ToString();
Actualizar.Myform.txtmiembro.Text = tabla.Rows[0]["FMIEMBRO"].ToString();
Actualizar.Myform.comboBox1.Text = tabla.Rows[0]["CONGREGACION"].ToString();
Actualizar.Myform.txtnacimiento.Text = tabla.Rows[0]["F_NACIMIENTO"].ToString();
Now, I need to bring the results that I inserted into the database through a radio, back to the radio and I have no idea how to do it.
To insert in a radio, I used two ways:
Example:
String gender: genre="M";
This is the way I entered the database:
private void btm_actualizar_Click(object sender, EventArgs e)
{
DateTime nacimiento = DateTime.Parse(txtnacimiento.Text);
DateTime conversion = DateTime.Parse(txtconversion.Text);
DateTime bautismo = DateTime.Parse(txtbautismo.Text);
DateTime miembro = DateTime.Parse(txtmiembro.Text);
var registrar = new Clases.Registro(txtCedula.Text, txtNombre.Text, txtApellido.Text, txtTelefono.Text, txtDireccion.Text, genero, ecivil, hijos, txtCelular.Text, nacimiento);
registrar.registrar();
var info = new Clases.InfoEcle(txtCedula.Text, conversion, bautismo, espiritusanto, bautizoiglesia, miembro, cajatexto);
info.registrar();
registrar.ListarDataGrid(Vistas.Buscar.FrmBuscar.dgv_buscar);
}
private void rdhombre_CheckedChanged(object sender, EventArgs e)
{
genero = "H";
}
private void rdmujer_CheckedChanged(object sender, EventArgs e)
{
genero = "M";
}