update an audit table

jassie

Well-known member
Joined
Nov 13, 2012
Messages
61
Programming Experience
1-3
In a C# 2010 desktop application, I need to add an audit table to an application that would be similar to the 'main' table. Basically whenever anyting is changed in the 'main' table I need to show the corresponding change in the 'audit' table. The 'audit' table will be a mirror copy of the 'main' table. The only difference is one table is called 'main' table and the other table is called the 'audit' table.
**Note these table reside in a sql server 2008 r2 database.
Would you setup a trigger? If so, can you show me the sql you would use?
Would you write C#.net 2010 code? If so, can you show me the code that would solve my problem?
 
Would you setup a trigger?
That would be the most appropriate way to do it.
If so, can you show me the sql you would use?
That's not really anything to do with C# so it doesn't really belong in this forum. Rather than just getting someone else to write the code for you, how about you do some reading on triggers in SQL Server? You can first get an understanding of how they work and then read about the CREATE TRIGGER statement to get an understanding of how to create them. You can then try to create one for yourself and test it. If it doesn't work, post a question in an appropriate forum showing what you did and explaining what happened and then people can help you fix it.
 
Back
Top Bottom