How to find out that data was really changed?

sinys

Member²
I want to find out that data in record was really changed
With OracleDataSet1 do
begin
Edit;
FieldByName('id').AsInteger := 1; // old value = 1 and new value = 1
... // There are a lot of records where old value is equal new value
Post;
if Modified then ... // Modified = True, but it's not right actually
end;

Is there a property which can show changing data in record in fact? (If not, please add this property)
 
Yes,
Example:

With OracleDataSet1 do
begin
Edit;
FieldByName('id').AsInteger := 1; // old value = 1 and new value = 1
Post; // -> GoTo BeforePost
end;

...
...BeforePost...
if Modified then
begin
FieldByName('date_change').AsDateTime := Now;
FieldByName('user_change').AsInteger := CurUser;
...
end;
 
sinys said:
We do not use triggers.
Then you need to consider changing your policy.
That is where it is easily and reliably done.
Otherwise, roll your own, you will have to store the original information on fetch and compare it before posting.
A lot more work and a lot less reliable.
 
Back
Top