Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to make an audit log for visual foxpro

Status
Not open for further replies.

catchme24

Programmer
Jun 27, 2011
2
ME
Hi all,
I am programmer but I am new in visual foxpro. I would like to make
an audit log for foxpro, so register who, when and what had made the changes on database. I know that this I can make with triggers but I dont know more.
So if someone can send me tutorial (video or pdf), samples with audit log or something it will be good that he/she can do it.

Thank you all
 
I wrote an article for Foxpro Advisor magazine a few years ago that explained exactly what you want to know. Unfortunately, I no longer have a copy, and the magazine is no longer available.

You're right that the easiest way is to use triggers, but that will only work if the tables are in a "database container", that is, if there is a DBC file.

Assuming that's not a problem, you need to create a new table to hold the audit log. It needs fields for the user name, time of the update, name of table being updated, name of field being updated, old value, new value, and whether it is update, delete or insert.

Then, in each of the triggers of every table that you want to audit, you write code that inserts a record into the audit table.

This is an over-simplified explanation, but it will get you started. Ultimately, you will have to write the code yourself.

Also, while forum members will be happy to post snippets of code in the forum, you can't expect them to send you complete tutorials or working examples.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
It is the DBC file, so I have to write triggers.
If someone can send me tutorial and examples it is
so much easy for, otherwise I will have hard to do that beacuse I dont have so much time for that.

Thank you
 
Look out for TaxRI download at universalthread. It's a tool for adding referential integrity triggers including an audit log. Complete and ready to use.

Bye, Olaf.
 
If you want a general VFP tutorial, you can find free on-line videos at:
Note - as Mike suggested above, we are here to gladly offer advice and suggestions on helping YOU understand how YOU can do the work.
We are not here to do the work FOR someone - especially those who "don't have the time for that".
In fact the Tek-Tips Round Table just had a discussion about flagging those posting suspected of being student homework projects or someone merely wanting us to do the work totally FOR them. The consensus of advisors was that if such a posting was 'flagged', the user would be totally thrown out of the forum - please keep that in mind.

Regardless, VFP data tables can be 'FREE' tables (not contained) or they can be contained within a VFP Database. The VFP Database (DBC) can support data table features that are not supported within 'free' data tables. These additional features includes triggers which can be created and then, since any trigger can do any number of actions, the code for the trigger must be created to meet the individual project needs.

And you might do a Google search for: VFP Audit log You might find some other answers.

Good Luck,
JRB-Bldr
 
Catchme24,

JRB-Bldr has given you some good advice, which I agree with.

That said, I realise this is your first time in this forum, and I hope you won't feel that some of our comments have been negative.

The point is that we are all ready and willing to help you by answering specific questions and posting examples of code. What we can't do is to send you tutorials or videos or complete solutions. The aim of the forum is for us all to share our knowledge, not to do your work for you.

I suggest you give some thought to how to use triggers along the lines that we've suggested. If you get stuck, come back with some specific questions, and we'll do our best to help.

A (belated) welcome to the forum, and to Visual FoxPro.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi,

Here you will find the Spanish version of an article writen by Nancy Folsom, Auditing FoxPro Table Add, Edit, and Delete Events. It provides sample code.

Good luck,

Miguel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top