wich field(s) was changed?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Willo
Posts: 34
Joined: Thu 24 Aug 2006 18:29

wich field(s) was changed?

Post by Willo » Wed 14 Nov 2007 18:31

hi;

im using a Tmyquery to populate a CRdbgrid that allows edits on its cells, is there a way to log the changes to the data, writing some code on the TMyquery's BeforePost event?

im using D7, MySQL 5

TIA

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Thu 15 Nov 2007 09:38

I'm using something like that on the OnBeforePost event :

If MyQuery.Fieldbyname('Field').NewValue MyQuery.Fieldbyname('Field').oldValue Then
MyQuery.Fieldbyname('LastModification').asDateTime := now();

Willo
Posts: 34
Joined: Thu 24 Aug 2006 18:29

Post by Willo » Thu 15 Nov 2007 14:43

swierzbicki wrote:I'm using something like that on the OnBeforePost event :

If MyQuery.Fieldbyname('Field').NewValue MyQuery.Fieldbyname('Field').oldValue Then
MyQuery.Fieldbyname('LastModification').asDateTime := now();
well thats fine, but i was thinking on a more generic rutine to log changes on any table. but i didnt know anything about "Newvalue" and "Oldvalue", maybe i can figure out some code that i can use with those properties.

Thanks!

Post Reply