Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Urgent Help ! Hilmar about your myaudit trail
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Urgent Help ! Hilmar about your myaudit trail
Divers
Thread ID:
00983323
Message ID:
00983323
Vues:
57
Hi Hilmar,
a couple of days ago i've asked this question but i couldnt find solution, why as you know
at the command window when i want to add some records or delete or update myaudit() gives error . please help me for solve this problem

TIA

here is below my (your) stored procedure myaudit() codes

PS: i've only added i remember date field to the myaudit.dbf
* Basic audit-trail function
* (Sample, for the article)
Function MyAudit(tcTriggerType)
Local lnField, lcFieldName, lcTable, lcUserName, lcChanges
If Type("gcUserName") = "C" && if public variable for the user has been declared
	lcUserName = gcUserName
Else
	lcUserName = "???"
Endif
lcTable = Juststem(Dbf())
lcChanges = ""
Do Case
Case tcTriggerType = "D"
	* nothing is required here, unless you want to
	* save oldval(...) for each field
	* (in case the user made changes, and then deleted the record)
Case tcTriggerType = "I"
	For lnField = 1 To Fcount()
		lcFieldName = Field(lnField)
		lcChanges = lcChanges + lcFieldName + ": ";
			+ Transform(Eval(lcFieldName));
			+ Chr(13) + Chr(10)
	Next
Case tcTriggerType = "U"
	For lnField = 1 To Fcount()
		lcFieldName = Field(lnField)
		lcChanges = lcChanges + lcFieldName + ": ";
			+ Transform(Oldval(lcFieldName)) + " -> ";
			+ Transform(Eval(lcFieldName));
			+ Chr(13) + Chr(10)
	Next
Endcase
Insert Into MyAudit;
	(TableName, UserName, TrigType, WhenChang, Changes,Date);
	values;
	(lcTable, lcUserName, tcTriggerType, Datetime(), lcChanges,Date())
Endfunc
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform