Help: "Record not found or changed by another user"
Posted: 20.03.2009, 19:37
Hi,
I have Delphi 7, ZeosLizb components and MySQL 5. The Connection and Query components are Zeos, and each Query is connected to a DataSetProvider, and ClientDataSet.
There is this simple process to determine the total value of purchases on an invoice. I'm encapsulating or wraping tables as DataBase objects. Each object has properties mapped to table fields (on thr read/write logic of the property), and the object contains the ClientDataSet associated to the table. So, the code to calculate totals is as follows:
"pe_regoper" is the db object related to the master table, and "Partidas" is a property that is a db object itsellf, and points to detail data:
__________________________________________________
if (pe_regoper.Cierre = 'N') and (not pe_regoper.Partidas.z_DataSet.EOF) then
begin
pe_regoper.z_DataSet.Edit;
pe_regoper.TotalImporte:= 0;
pe_regoper.TotalIVA:= 0;
with pe_regoper.Partidas.z_dataSet do
begin
First;
while not Eof do
begin
pe_regoper.TotalImporte:= pe_regoper.TotalImporte + pe_regoper.Partidas.Importe;
pe_regoper.TotalIVA:= pe_regoper.TotalIVA + pe_regoper.Partidas.IVA;
next;
end;
end;
pe_regoper.z_dataSet.Post;
if TClientDataSet( pe_regoper.z_dataSet ).ApplyUpdates(0) > 0 then
TClientDataSet( pe_regoper.z_dataSet ).CancelUpdates;
__________________________________________________
The process is done correctly and the sum is calculated Ok. The problem comes on the ApplyUpdates, where I get "Record not found or changed by another user". This is shown for any invoice I process and of coursem there are no other users here, since I'm doing it on my standalone PC. What could it be?
Thank you,
Guillermo
I have Delphi 7, ZeosLizb components and MySQL 5. The Connection and Query components are Zeos, and each Query is connected to a DataSetProvider, and ClientDataSet.
There is this simple process to determine the total value of purchases on an invoice. I'm encapsulating or wraping tables as DataBase objects. Each object has properties mapped to table fields (on thr read/write logic of the property), and the object contains the ClientDataSet associated to the table. So, the code to calculate totals is as follows:
"pe_regoper" is the db object related to the master table, and "Partidas" is a property that is a db object itsellf, and points to detail data:
__________________________________________________
if (pe_regoper.Cierre = 'N') and (not pe_regoper.Partidas.z_DataSet.EOF) then
begin
pe_regoper.z_DataSet.Edit;
pe_regoper.TotalImporte:= 0;
pe_regoper.TotalIVA:= 0;
with pe_regoper.Partidas.z_dataSet do
begin
First;
while not Eof do
begin
pe_regoper.TotalImporte:= pe_regoper.TotalImporte + pe_regoper.Partidas.Importe;
pe_regoper.TotalIVA:= pe_regoper.TotalIVA + pe_regoper.Partidas.IVA;
next;
end;
end;
pe_regoper.z_dataSet.Post;
if TClientDataSet( pe_regoper.z_dataSet ).ApplyUpdates(0) > 0 then
TClientDataSet( pe_regoper.z_dataSet ).CancelUpdates;
__________________________________________________
The process is done correctly and the sum is calculated Ok. The problem comes on the ApplyUpdates, where I get "Record not found or changed by another user". This is shown for any invoice I process and of coursem there are no other users here, since I'm doing it on my standalone PC. What could it be?
Thank you,
Guillermo