Editing records with TMSTable

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
xxxFALKORxxx

Editing records with TMSTable

Post by xxxFALKORxxx » Tue 25 Jan 2005 02:44

Hi;

im doing something wrong?...

im trying to edit a record on a table, but instead of change the record information, i got a new record with almost the same values (except for those i changed).

here is my code:

DM.Tsocios.Edit;
DM.TsociosSOCIO.value := Esocio.Text;
DM.TsociosNOMBRE.value := Enombre.Text;
DM.TsociosFECHAINGR.value := Efechaing.Date;
DM.TsociosESTATUS.value := Copy(CBEstatus.Text,1,1);
DM.TsociosIDPROMOTOR.value := Epromotor.Text;
DM.TsociosIDRECOMIENDADO.value := Erecomenda.Text;
DM.TsociosSEXO.value := Copy(CBsexo.Text,1,1);
DM.TsociosCALLE1.value := Ecalle1.Text;
DM.TsociosCALLE2.value := Ecalle2.Text;
DM.TsociosTELEFONO.value := Etelefono.Text;
DM.TsociosCP.value := Ecp.Text;
DM.TsociosCURP.value := Ecurp.Text;
DM.TsociosRFC.value := Erfc.Text;
DM.TsociosOCUPACION.value := Eocupacion.Text;
DM.TsociosINGRESOS.value := Eingresos.Value;
DM.TsociosFECHANACIMIENTO.value:= Efechanac.date;
DM.TsociosIDPROFESION.value := Copy(CBprofesion.Text,1,5);

If Ezona.text '' then
DM.TsociosZONA.value := Strtoint(Ezona.Text)
else
DM.TsociosZONA.value := 0;

If Eempleado.text '' then
DM.TsociosEMPLEADO.value := Strtoint(Eempleado.Text)
else
DM.TsociosEMPLEADO.value :=0;

If Eantigcasa.Text '' then
DM.TsociosANTIGUEDADCASA.value := Strtoint(Eantigcasa.Text)
else
DM.TsociosANTIGUEDADCASA.value := 0;

If Enumdepend.Text '' then
DM.TsociosDEPENDIENTES.value := Strtoint(Enumdepend.Text)
else
DM.TsociosDEPENDIENTES.value := 0;

If Eantigemp.Text '' then
DM.TsociosANTIGUEDAD.value := Strtoint(Eantigemp.Text)
else
DM.TsociosANTIGUEDAD.Value := 0;

If Ecaja.Text '' then
DM.TsociosCAJA.value := Strtoint(Ecaja.Text)
else
DM.TsociosCAJA.value := 0;

DM.TsociosIDCOLONIA.value := Copy(CBcolonia.Text,1,5);
DM.TsociosOTRA_CAJA.value := Copy(CBotracaja.Text,1,1);
DM.TsociosDOMICILIO.value := Edomicilio.Text;
DM.TsociosRENTACASA.value := Erenta.Value;
DM.TsociosESTADOCIVIL.value := Copy(CBedocivil.Text,1,1);
DM.TsociosIDCIUDAD.value := Copy(CBciudad.Text,1,5);
DM.TsociosIDESTADO.value := Copy(CBestado.Text,1,5);
DM.TsociosCASA.value := Copy(CBcasa.Text,1,5);
DM.TsociosCONYUGE.value := Econyuge.Text;
DM.TsociosOCUPACONYUGE.value := Eocupaconyuge.Text;
DM.TsociosTUTOR.value := Etutor.Text;
DM.TsociosNOMOTRACAJA.value := Copy(CBotracaja.Text,1,1);
DM.TsociosCOMPDOM.value := CKactamat.Checked;
DM.TsociosACTAMATRI.value := CKactamat.Checked;
DM.TsociosACTANACI.value := CKactanac.Checked;
DM.TsociosIDENTFOTO.value := CKidefoto.Checked;
DM.TsociosCOMPINGRE.value := CKcompingr.Checked;
DM.TsociosTIPO.value := 'A';

DM.Tsocios.Post;

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Re: Editing records with TMSTable

Post by Ikar » Tue 25 Jan 2005 09:47

Check the value of SQLUpdate. Most likely in your case it must be set to ''.

Post Reply