Help: "Record not found or changed by another user"

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
alquimista
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 09.03.2009, 21:36

Help: "Record not found or changed by another user"

Post by alquimista »

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
alquimista
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 09.03.2009, 21:36

Post by alquimista »

This seem to be a bug in Zeos components v6.6.4. I replaced the Connector and Query components of Zeos, with a commercial set of dbExpress components for MySQL ... and the problem has been solved.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

You may be hitting the long lasting TClientDataset bug #100 . I suppose you really need the TClientDataset and Datasetprovider... I hope somebody smarter than me will once be able to fix this...

Mark
Image
alquimista
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 09.03.2009, 21:36

Post by alquimista »

I use TClientDataSet and DataSetProvider because makes life easier when updating datasets that show db Views, allowing to specify the underlying table that should be updated on the OnGetTableName of the DataSetProvider. Most of my DataSets shows db Views which data can be updated by the end user, and without Providers/ClientDataSet I'd have to write insert/delete/update statements with ZUpdate and link those with the corresponding ZQuery components. For a medium/large system, the Provider saves me time in coding/testing.

So, if this bug remains, I would not be able to use ZeosLib, which is sad. I'd rather use and contribute with Zeos comunity rather than paying a commercial set of dbExpress components for MySQL/PostgreSQL

Saludos,
Guillermo
Post Reply