0

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?

3 Answers 3

1

You can use the power of SQL Server Auditing https://sqlblog.org/2008/05/06/when-was-my-database-table-last-accessed or you can create trigger to audit your SQL Server database http://weblogs.asp.net/jgalloway/archive/2008/01/27/adding-simple-trigger-based-auditing-to-your-sql-server-database.aspx

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.