Session Variables in ASP

Status
Not open for further replies.

techthis

Solid State Member
Messages
10
hi...i did a search for Session variables and only found them relating to PHP...im using asp...ive created a form when a user clicks next it brings up a page that displays their info...if they agree, their info is passed to a database...i cant seem to get the session variables to stick when going from display.asp to insert.asp...here is my code...

---display.asp--- (works fine)
<%
'declare your variables
Dim name, email, comments

Session("name") = Request.Form("name")
Session("email") = Request.Form("email")
Session("comments") = Request.Form("comments")

response.write(Session("name")) & "
"
response.write(Session("email")) & "
"
response.write(Session("comments")) & "
"
%>

---insert.asp--- (does not work)
<%
'declare your variables
Dim name, email, comments
Dim sConnString, connection, sSQL

Session("name")
Session("email")
Session("comments")

'declare SQL statement that will query the database
sSQL = "INSERT into tempusers_tbl (name, email, comments) values ('" & _
name & "', '" & email & "', '" & comments & "')"

'define the connection string, specify database
'driver and the location of database
sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("users.mdb") & ";"

'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Open the connection to the database
connection.Open(sConnString)

'execute the SQL
connection.execute(sSQL)

' Done. Close the connection object
connection.Close
Set connection = Nothing
%>



...i dont think im calling the session correctly in insert.asp...ive tried a number of ways...thanks for your time...
 
Status
Not open for further replies.
Back
Top Bottom