error al tratar de modificar un registro
Publicado por diego (20 intervenciones) el 05/04/2021 03:10:36
tengo el sgte error al tratar de modificar un registro:error mostrado adjunto

este es el codigo:
gracias al q me pueda ayudar

este es el codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
private void btnGuardar_Click(object sender, EventArgs e)
{try
{ //La variable que almacena si se inserto //o se modifico la tablastring rpta = "";
if (this.txtNombre.Text == string.Empty || this.txtApellidos.Text == string.Empty
|| txtNum_Documento.Text == string.Empty)
{MensajeError("Falta ingresar algunos datos, serán remarcados");
errorIcono.SetError(txtNombre, "Ingrese un Valor");
errorIcono.SetError(txtApellidos, "Ingrese un Valor");
errorIcono.SetError(txtNum_Documento, "Ingrese un Valor");
}else
{if (this.IsNuevo)
{ //Vamos a insertar un clienterpta = Ncliente.Insertar(this.txtNombre.Text.Trim().ToUpper(),
this.txtApellidos.Text.Trim().ToUpper(), cbSexo.Text,
(Convert.ToDateTime(this.dtFechaNat.Value)),
/*dtFechaNat.Value,*/cb_Tipo_documento.Text, txtNum_Documento.Text,
txtDireccion.Text,txtTelefono.Text, txtEmail.Text);
}else
{ //Vamos a modificar un Clienterpta = Ncliente.Editar(Convert.ToInt32(this.txtIdCliente.Text),
pnombre: this.txtNombre.Text.Trim().ToUpper(),
papellidos:this.txtApellidos.Text.Trim().ToUpper(), psexo:cbSexo.Text,
pfecha_nacimiento:this.dtFechaNat.Value, ptipo_documento:cb_Tipo_documento.Text,
pnum_documento:txtNum_Documento.Text, pdireccion:txtDireccion.Text,
ptelefono:txtTelefono.Text, pemail:txtEmail.Text);
} //Si la respuesta fue OK, fue porque se modifico //o inserto el Cliente //de forma correctaif (rpta.Equals("ok"))
{if (this.IsNuevo)
{this.MensajeOK("Se insertó de forma correcta el registro");
}else
{this.MensajeOK("Se actualizó de forma correcta el registro");
} }else
{ //Mostramos el mensaje de errorthis.MensajeError(rpta);
}this.IsNuevo = false;
this.IsEditar = false;
this.Botones();
this.Limpiar();
this.Mostrar();
this.txtIdCliente.Text = "";
} }catch (Exception ex)
{MessageBox.Show(ex.Message + ex.StackTrace);
}}private void btnEditar_Click(object sender, EventArgs e)
{ //Si no ha seleccionado un Cliente no puede modificarif (!this.txtIdCliente.Text.Equals(""))
{this.IsEditar = true;
this.Botones();
Habilitar(true);
}else
{this.MensajeError("Debe buscar un registro para Modificar");
}}gracias al q me pueda ayudar
Valora esta pregunta


0
