This topic is locked

REMOTE_USER and timestamp fields

9/25/2003 6:38:52 PM
ASPRunnerPro General questions
cagleyleslie author

I would like to show in my database who entered the data. When I create a form in frontpage to edit my database, I can add REMOTE_USER and timestamp, and have those show up in a table, but I like your edit screens better. Is there any way I can do this with yours? I care more about the REMOTE_USER than the timestamp. Thanks!

Sergey Kornilov admin 9/30/2003

Hi,
you can easily add both fields to INSERT and UPDATE SQL statements. Open your ..._edit.asp file in the text editor and find two sections of code in the beginning of file where INSERT and UPDATE statements are built.
If you have problems doing this I can help you with it. Sust zip and send me your ASP files, include files and your database. Send it to support AT xlinesoft.com.
Best regards,

Sergey Kornilov

A
alexander 4/9/2004

Hi Sergey, do you think you could elaborate on this a bit more? I too need to do the same thing, but I can't seem to find the correct field to put my code. What does the code look like on the edit page where I can specify my value? Here's what I need to do:
I have a username field and a date field. When the record is opened for edit, I want the date field to automatically populate with the current date, so it will automatically update on submission. The username field would automatically populate with a server variable username. Here's the type of field I use in my ASP field code, but I can seem to incorporate it into the edit page code:
<input type="text" size="35" name="Username" value="<% =mid(Request.ServerVariables("REMOTE_USER"),7,100) %>" >
Thanks for your help.

Sergey Kornilov admin 4/11/2004

Alexander,
I would recommend another way.
On the ..._edit.asp page find a code snippet that builds SQL query for INSERT and modify strSQL variable to insert REMOTE_USER. See my changes in bold.

strFields = strFields & "REMOTE_USER_FIELD"

strValues = strValues & "'" & mid(Request.ServerVariables("REMOTE_USER"),7,100) & "'"
' adjust strFields and strValues

if Right(strFields,2)=", " then strFields = Left(strFields, Len(strFields)-2)

if Right(strValues,2)=", " then strValues = Left(strValues, Len(strValues)-2)

500983 4/12/2004

Hi Alexander,

I had the same need to track who is updating (or creating) a record and when.

I have 4 fields in each table to manage this :

WhoCreate, WhenCreate, WhoUpdate, WhenUpdate.

I make the first two available in the add page, and the two other in the edit page.

Each fields are "hidden field" with default value being Session("UserID") or Now().
It works very well.
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=1584&image=1&table=forumreplies' class='bbc_emoticon' alt=':ph34r:' />