Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 13th, 2012, 01:36 AM
Registered User
 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Capturing User Info on updates to an audit table

I've used your book as the basis of my website, and the book was very helpful in all aspects of my development, but I'm stuck trying to add some auditing features to my site. I've created a simple table that contains a character field and an integer field, and on that table I've created a simple trigger that fires on any updates to an audit table that i want to hold both the old and new values of the integer, along with the system time and the user that did the actual update. While I'm capturing both the old and the new values, along with the system time, I'm lost as to how I would capture the user that did the update. My site uses the standard asp.net login controls, so I can capture the user in the code behind, and the update is being done via a standard gridview. My trigger can use SUSER_SNAME(), but that is capturing the actual pc name and not the user name. I'm unsure if i can capture this info in the sql trigger. I was thinking maybe i somehow try to join with the asp.net security db or try using the profile.user.name or something along that line. Any thoughts on how i would go about it?

Thx Again

Last edited by smjg; December 13th, 2012 at 01:41 AM.. Reason: adding more detail
 
Old December 14th, 2012, 03:57 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

For questions not directly related to the book, you're better off posting in a more general ASP.NET forum from this list http://p2p.wrox.com/asp-net-4-539/ as you'll attract more viewers.

That said, you can pass the user name along with your insert and update statements. You find an example here: http://imar.spaanjaars.com/571/letti...t-45-web-forms Although the article discusses using the user name as a filter, you can also use it in INSERT and UPDATE statements.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 14th, 2012, 05:29 PM
Registered User
 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx, will post any further questions there





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure That Updates Table GailCG Classic ASP Professional 1 January 22nd, 2006 01:11 PM
Check if user is registered for email updates brettdalldorf ASP.NET 1.0 and 1.1 Basics 4 July 8th, 2005 10:01 AM
Table Audit jesseleon SQL Server 2000 3 July 16th, 2003 02:04 PM
Table Audit jesseleon Access VBA 2 June 10th, 2003 12:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.