This topic is locked
[SOLVED]

 Capture User and Timestamp on changes

4/24/2018 9:03:51 AM
ASPRunner.NET General questions
N
nfgcgrb author

Help please,
Using ASPRunner.Net 9.8 Microsoft SQL 2014 in Windows 7
When a user edits/adds/updates a record I store it in the audit table.
I'd also capture and store the last who and when with the current record. Capture a date/time (LastUpdated) and current user (UpdatedBy) that made the change and store it in the database, and not allow the user to edit the fields.
I've tried
values["LastUpdated"] = new XVar(DateTime.Now); also = now()

values["LastUpdatedBy"] = XSession.Session["UserID"];
In Before Record updated and before record added, but get a build error

admin 4/27/2018

Something like this should work:

values["LastUpdated"] = DateTime.Now.ToString();

values["LastUpdatedBy"] = XSession.Session["UserID"];


If not, you need to post exact code and exact error message.

N
nfgcgrb author 4/30/2018



Something like this should work:

values["LastUpdated"] = DateTime.Now.ToString();

values["LastUpdatedBy"] = XSession.Session["UserID"];


If not, you need to post exact code and exact error message.


That worked great, thank you!