|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Creating session variable
Working on a survey with results going into an Access (2002) database. Each survey-taker would be a new, unique entry in the survey-taker table, and the primary key is set as an autonumber.
The survey is several pages long, and I need a way for the autonumbered primary key to carry over to each page in order to keep the results together. Here is my question: Would creating a session variable tied to the primary key work, or am I going about this all wrong? If a session variable would work, how do I tie it to an autonumber? Thanks in advance. |
|
#2
|
|||
|
|||
|
A session variable would work also I'm assuming your using a form so you could also use a hidden field and store the value of the primary key there. Anyway this is how you could use a session.
Code:
Session("SurveyKey") = Recordset.Fields("PrimaryKey")
That will create a session. So what you would do is on the first page you open the recordset and create a new record. Then return the value of the primary key and store in in a session like the code above. On all that survey pages do a query sorta like Code:
"SELECT * FROM tblSurvey WHERE PrimaryKey = " & session("SurveyKey")
If there are lots of questions then you might only want to return the fields on the current page. Anyway good luck. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Creating session variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|