Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Urgent Help ! Hilmar about your myaudit trail
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Urgent Help ! Hilmar about your myaudit trail
Miscellaneous
Thread ID:
00983323
Message ID:
00983323
Views:
58
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
Next
Reply
Map
View

Click here to load this message in the networking platform