This topic is locked
[SOLVED]

 Acquire user's LOGIN ID automaticly into database

10/28/2004 14:08:11
ASPRunnerPro General questions
L
laboria author

How do you capture a user's Login ID and have it saved in the database of the record the user edited or added.
I have read all of the posts and also asked this question, but I have not received a response...

L
laboria author 10/29/2004

Please assist me with this issue. I have been waiting a few days now.
Thanks.

Sergey Kornilov admin 10/29/2004

Here is how you can do this on the Edit page (..._edit.asp)

Next

if Right(strSQL,2)= ", " then strSQL = Left(strSQL, Len(strSQL)-2) '1
strSQL = strSQL & ", UserIDField = '" & Session("UserID") & "'"


Just replace UserIDField with field name where you like to store login ID.
Also you need to modify ADD page accordingly to enable Login ID insert.

L
laboria author 11/1/2004

The code works great on the edit page, but the add page is giving me syntax error in the insert to...
I posted the code after the following on the add.asp page:

Next

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

if Right(strValues,2)=", " then strValues = Left(strValues, Len(strValues)-2)
strSQL = strSQL & ", Tech = '" & Session("UserID") & "'"


Was I supposed to place it somewhere else or do more editing?
Thanks.

Sergey Kornilov admin 11/4/2004

Try the following:

Next

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

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

strValues = strValues & ", '" & Session("UserID") & "'"