Page 1 of 1

wich field(s) was changed?

Posted: Wed 14 Nov 2007 18:31
by Willo
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

Posted: Thu 15 Nov 2007 09:38
by swierzbicki
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();

Posted: Thu 15 Nov 2007 14:43
by Willo
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!