Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Username to database

Status
Not open for further replies.

NickyJay

Programmer
Sep 1, 2003
217
GB
Hi All,

Asked this in SQL Server forum and have been redirected here.

I hope this makes sense!

I have a set of pages that connect via ODBC to a SQL Server 2005 database. On my main table is a trigger to update an audit table with the field updated, the old value, new value, date updated and the user's.

The user name field is the one causing problems - its only recording the ODBC used to connect rather than the user from my secured pages. I have a login feature that records other changes etc, but can't pass the user name to the trigger...HELP!

Is there a way to do this as i sort of need to name and shame users that are changing data incorrectly!

Nicola
 
Your saving the wrong variable. You need to inspect your code and save the correct one.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
You have to pass the app user to your update somehow. I don't know how you're storing login info, but that's what you need to pass through to the update. Internal SQL actions will know the user associated with the connection, but not your Web app user. So the trigger code should pass the user field from the UPDATED table, not the SQL user.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Pity the insomniac dyslexic agnostic. He stays up all night, wondering if there really is a dog.
 
Yep, this is what i need but dont know how on earth to pass it! I have a table of user names and access levels, this is where my pages check the username and password, but how do i identify which user from the table has performed the action?

Nicola
 
How do you identify a user once they've logged in? Do you save their user info in a session variable?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top