Click here to Skip to main content
15,898,373 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Firstly...I apologize for my mistakes English

I create a trigger for operations on the tables ... I would like to store the ID User within the database which must be within trigger.

How can I bring ID as it is at the level of the session in asp.net?
Posted

Basically, you can't.

This is the problem when you try to do auditing in the database using triggers when the information you want ( the logged-in user ) is in the app.

Nick
 
Share this answer
 
Here is part of the code we use in our trigger that we insert into a log file:
SQL
SELECT
    GETDATE(), SYSTEM_USER, @@ServerName, APP_NAME(), HOST_NAME(), ...(inserted/deleted info)

maybe it will help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900