user998405
user998405

Reputation: 1339

Trace the database when any table is insert update or delete

just a simple question. Is that any way to trace the database when any table is insert update or delete recently?For example I update 4 user detail in my database. A log file will be create and log that 4 record has been update in user table.

Is it possible to make it?

Upvotes: 0

Views: 1579

Answers (3)

Emmanuel N
Emmanuel N

Reputation: 7449

I would recommend using Triggers in Database layer and log changes to a table in the database instead of flat file, so that changes will be recorded regardless where changes have be made. Then write something on your UI to display entries from your log table.

Upvotes: 0

Icarus
Icarus

Reputation: 63956

You have the answer to your question, right on your tags: use a logging library such as log4net or elmah and log every time an insert/update/delete occurs...

Or implement something on the DB side to insert a record in an audit table every time and insert/update/delete occurs on the table you want. You can use a database trigger, for example.

The bottom line is that you have to write the code/logic to do this.

Upvotes: 0

Related Questions