Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date of Last Update Field...
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00362891
Message ID:
00363199
Vues:
15
>What is the easiest way to populate a Date of Last Update field with the current date if the value for ANY other field has changed? I am using table buffered views. I believe this eliminates the use of Update Trigger.

Hi Mark,

If the table is part of a Database, it could be easily done. Create a stored procedure or program and on Table level call this function. I've done this (after asking similar question here :) and now leave happy. Here is my SP.
Be aware, that it will change all records in the table, when you place it first time, unless you add some logic to prevent it.
Function UpdateModidate
local ldDateTime
ldDateTime=datetime()
replace modidate with ldDateTime
return .t.

Function UpdateUserID
local lcUserID
if type('oJC')='O' && Job Control is already instantiated
     lcUserID=oJC.UserID
else
    lcUserID=''     
endif    
if !empty(lcUserID)
     replace UserID with lcUserID 
endif     
return .t.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform