CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Adding an audit Trail

Print topic Send  topic

Author Message
grivers

Posts: 28
Posted: 08/21/2008, 7:39 AM

Is there an easy way of recording changes made by a user to a record form. In other words I have a page that I use just to edit existing records and I want to be able to add an audit trail so I know what user has changed any of the detail on the form and what they changed?
View profile  Send private message
Trigger
Posted: 08/22/2008, 8:11 PM

If your database supports triggers, then it can be implemented in the
database itself. Most
relational databases like MSSQLServer, DB2, and Oracle have it built in but
I think that
triggers are the easiest route.

Tim

"grivers" <grivers@forum.codecharge> wrote in message
news:648ad7e15682b4@news.codecharge.com...
> Is there an easy way of recording changes made by a user to a record form.
> In
> other words I have a page that I use just to edit existing records and I
> want to
> be able to add an audit trail so I know what user has changed any of the
> detail
> on the form and what they changed?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

wkempees


Posts: 1679
Posted: 08/23/2008, 9:08 AM

What do you want to register, besides user/ip/date/time:
1:the record before and after
2:the changed fields only
3 the changed fields as well as ther before and after values.

see this post: http://forums.codecharge.com/posts.php?post_id=99822
in which a function is used to do something other than you request but it does offer the (a)solution to getting the 'before' values.
You could do almost 80% of what is posted there, just in stead of doing a geocode, write a logging row.

(hm, and add the ASP specific transformations)
Walter

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
Benjamin Krajmalnik
Posted: 08/23/2008, 6:05 PM

I would probabl make an XML representation of the record, so it is global as
far as structure and unaffected by any future structure changes.

marcwolf


Posts: 361
Posted: 08/24/2008, 1:59 AM

As mentioned before - the easiest way to implement an audit trail is to use triggers on the database side.

The advantage of this is that it will work regardless of how the information was changes. If someone tried SQL injection the suste will still work.

The next question is WHAT do you want to log.

If there are only several key fields then you can just watch for changes in these fields and write an audit record if requires.

The next is a little more ambitious - full record image auditing.

In the before update you run a started procedure that writes (usually to a seperate DB for additional security) a copy of the record you are updating complte with a 'Premod' flag.
In the After Update trigger you d the same except not write the updated record with the 'Postmod' flag.
This way you can see anything and everything that has been changed for each row.

I have implemented both with considerable success.

Take care
Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
grivers

Posts: 28
Posted: 08/26/2008, 1:36 AM

Thanks to all that have posted replies thus far.
I am using MS access so not sure how Triggers can be implemented.
I don't need to log what fields have changed and what they changed to/from.
What I am trying to acheive is a log against each record so when you go into edit record you view a history of the changes to the record. So when you go into the record and edit it then press submit the log is updated with the user id, user name and the date the record was edited. Don't need any more info than that at this stage.
View profile  Send private message
Oper


Posts: 1195
Posted: 08/26/2008, 5:35 AM

MS Access dont use trigger at least till version 2007

one easy choice is (of course without knowing you code logic)

Create 1 Function

SecurityLog("E",IDrecord,Comment)

U=Edit, D=Delete, I=Inser, V=View

On before delete event
SecurityLog("D",IDRecord,"Any Comment Here")


On Update Event
SecurityLog("U",IDRecord,"Any Comment Here")



so you just need to create a Small function that you coudl use anywhere and whoe ver you wnated inserting any comment you want if needit

so in the function just generate some SQL like this:

INSERT INTO SECURITYLOG (Fecha,FechaSmall,ProgramName,UserLog,Description,Tipolog,IPString) VALUES (.

value for MSAcces both Fecha(Date Value) by defaultr MSaccess allow more than one Date
value as Default
Programa name are eassy to get from teh server
Userlog is ccgetuserid() or ccuserlogin() who ever you like
Description is whaever you want
Tipolog = U,D,E,I
and IP string getting from server.


very simple, but this is one way there are a lot.







Trigger normaly is tyhe best choice for all my Project i use Both always







_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.