I want to create a trigger in foxpro that will execute after every update in my db table, for example JobActivity.After every update, the trigger should insert the update time in the table JobActivity.
A:
You would want to use the Create Trigger command then, except you have one problem: a VFP trigger cannot update the table which fires it (as otherwise it would end out in an endless loop)
I had a solution for this in a project I did many years ago, I think it used the Record Validation rule to do the update, I will look it up when I get home and post it.
Stuart Dunkeld
2010-10-18 13:14:50
+2
A:
Instead of AFTER the update, you could apply a Record RULE validation (as @Stuart Dunkeld mentions) that is applied against the entire record before the insert/update is processed.
Go to your database container and create a stored procedure something like
FUNCTION SP_LastUpdated()
replace LastEditDT WITH DATETIME()
RETURN .t.
ENDFUNC
Then, for the record validation rule, put in SP_LastUpdated().
DRapp
2010-10-18 13:27:05