Quote:
Originally posted by sajeed
If I put this tag on my display.asp page then it shows my username from the other database <%= Session ("MyLoginNickName") %>
I created a field in my access db called Createdby. Now how should I write the code in my add.asp form so that when I add something to the access db it records my username also. Please help.
Thanks
|
If the display.asp page is the first page, then right after wherever on the page that the Nick name is first defined, set up the session variable like this:
Session("MyLoginNickName") = xloginNickName
Somewhere in your add.asp file is an INSERT statement that takes the entered data and places it in the database.
It should look something like:
SQLx= "INSERT INTO (numfield1, strfield2, numfield3) VALUES (" & numvalue1 & ", '" & strvalue2 & "', " & numvalue3 & ")"
Simply find this existing statement, and add your field to it...
SQLx= "INSERT INTO (numfield1, strfield2, numfield3, createdby) VALUES (" & numvalue1 & ", '" & strvalue2 & "', " & numvalue3 & ", '" & Session ("MyLoginNickName") & "')"
Notice the single quotes around the string variables.
Hope this helps...
Tim