Link to home
Create AccountLog in
Avatar of bkourouma
bkourouma

asked on

Table auditing in SQL / ASP.NET

I have an application web with a separate website administration site.

I want to be able to log old/new data on insert/update/delete in a separate audit_table.

I have achieved that by using triggers but my problem is how do I get the user who is logged on using asp.net to add to the audit_table?

Please note that I want to achieve this WITHOUT having to pass a parameter to a stored proc. This is because i have hundreds of tables and I am not necessarily using stored proc...

Thanks
SOLUTION
Avatar of TheMegaLoser
TheMegaLoser
Flag of Sweden image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Anthony Perkins
It really depends on your connection.  I you are using SQL Server Authentication, as I suspect you are than you may have no choice, but to pass in the user name.
Both win and sql authentication works. I have tried both in SSMS.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.