This topic is locked

Default value to Session username

8/31/2005 11:18:04 AM
ASPRunnerPro General questions
sparkg author

Sorry, this was covered in an earlier post but I couldn't figure it out:

I have a user table with userName and passWord fields.

In my main table I have a field called createdBy.

I want to capture the user that created a new record.

As you said in earlier post, I set default for that field to Session("USER_ID")
Question...where in my login.asp I should put??
Session("USER_ID")=rs("UserName")
?? What line?
Do I have to edit any sql statement also?
Thanks!!

Sergey Kornilov admin 9/1/2005

Hi,
you need to set Default value - Session("UserID") for createdBy field on the Formattingtab in ASPRunner.

sparkg author 9/1/2005

That worked - simpler than I thought...thanks!!

sparkg author 9/1/2005

Actually, there is a problem.

I have set the default for a timestamp field to Now()

I have set the default for the creator field to Session("USER_ID")
These work fine but...when I set those two fields to be readonly they don't put in the default value.

If I turn off Add and Edit in the format screen of Runner, they don't put in the default value.
I don't want the user to be able to edit them.
Is that a bug? A request? or is there a different way to do it?
Thanks!

Sergey Kornilov admin 9/2/2005

Hi,
set Edit as format - Hidden field for these fields.

sparkg author 9/2/2005

Great thanks! That works.
I notice in my thread above that I was typing:
Session("USER_ID")
The correct syntax is:
Session("UserID") - as you stated in your response.
(Just to clarify for future references to this thread <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=5761&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />