Mysql Table Post

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
mbranco
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 20.12.2005, 16:33

Mysql Table Post

Post by mbranco »

Hi.

I have a small application to process invoices.

I create the invoice, but when a change the values the invoice table still have the last value.

I have tried to commit data, but the table still have the firts values.

What are the problem???

I use D7, Mysql 5, ZeosLib 6.5.1.

Code:


zroqCalc.Close;
zroqCalc.Sql.Clear;
zroqCalc.Sql.Add(SQL STATEMENT );
zroqCalc.Open;
ztDocumentos.edit;
ztDocumentosdesconto.Value := zroqCalcsumvdesconto.Value;
ztDocumentosTotalIva.Value := zroqCalcsumviva.Value;
ztDocumentosTotaliLiquido.Value := zroqCalcsumPIliquido.Value;
ztDocumentosTotalDoc.Value := zroqCalcsumPIliquido.Value - zroqCalcsumvdesconto.Value + zroqCalcsumviva.Value;
ztDocumentos.Post;

Thank's in advance

MB
mbranco
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 20.12.2005, 16:33

Post by mbranco »

ztDocumentos is a ZTable componen
and zroqCalcs is a zreadonlyquery component
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post by pol »

Hi!

After ztDocumentos.Post you have to add
ztDocumentos.ApplyUpdates
Only this will bring the posted data finally into the database. It took me some time too to get to that (thanks to the old forum).

HTH
Rüdiger
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

That should only be true if you have CachedUpdates = True on your dataset. Otherwise there's a problem there.

Ben
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post by pol »

Hi Ben!

What kind of problem? I never use CachedUpdates = True, but without ApplyUpdates... nothing in the database, as mbranco has experienced.
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

If you see the documentation for TBDEDataSet you'll see:

"Call ApplyUpdates to write a dataset’s pending cached updates to a database."

I assume zeoslib uses ApplyUpdates in the same way. Also I've been using Zeos now for some years against PostgreSQL and never had to call ApplyUpdates.

Regards,

Ben
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

Can you write the SQL used for data acquiring into the Query component?
Post Reply