JSMITH242B
Programmer
Hi Group,
I want to return a recordset in my ASP Page that is limited in the where clause by a session variable.
The datatype is int for data to be stored in the session variable.
This is how I've set the Session variable based on a defined recordset.
Session("schoolid") = objRS.("schoolid")
In my resulting page, I use this in my sql statement
strSql = strSql & " SELECT p.persref, "
strSql = strSql & " p.title, "
strSql = strSql & " p.surname, "
strSql = strSql & " p.firstname, "
strSql = strSql & " p.number, "
strSql = strSql & " p.letter, "
strSql = strSql & " p.addr1, "
strSql = strSql & " p.title, "
strSql = strSql & " p.firstname, "
strSql = strSql & " p.surname, "
strSql = strSql & " p.sex, "
strSql = strSql & " p.schoolid, "
strSql = strSql & " p.famref, "
strSql = strSql & " p.addref, "
strSql = strSql & " p.txtdob, "
strSql = strSql & " p.surgeryid "
strSql = strSql & " FROM person p "
strSql = strSql & " WHERE (dod = '' or dod is null) "
strSql = strSql & " AND p.schoolid = " & Session("schoolid")
when I do a response.write, the SQL statement reads "AND p.schoolid = <blank> " so the Session variable is not being passed/set.
So,
1. Do I need to pass the session variable as a hidden field?
2. What's the best way to pass a session variable from one page to the next
3. Can I use a Session variable if the resultant recordset returns more than one record but ALL values in the field I will use as the Session variable are unique?
Thanks
I want to return a recordset in my ASP Page that is limited in the where clause by a session variable.
The datatype is int for data to be stored in the session variable.
This is how I've set the Session variable based on a defined recordset.
Session("schoolid") = objRS.("schoolid")
In my resulting page, I use this in my sql statement
strSql = strSql & " SELECT p.persref, "
strSql = strSql & " p.title, "
strSql = strSql & " p.surname, "
strSql = strSql & " p.firstname, "
strSql = strSql & " p.number, "
strSql = strSql & " p.letter, "
strSql = strSql & " p.addr1, "
strSql = strSql & " p.title, "
strSql = strSql & " p.firstname, "
strSql = strSql & " p.surname, "
strSql = strSql & " p.sex, "
strSql = strSql & " p.schoolid, "
strSql = strSql & " p.famref, "
strSql = strSql & " p.addref, "
strSql = strSql & " p.txtdob, "
strSql = strSql & " p.surgeryid "
strSql = strSql & " FROM person p "
strSql = strSql & " WHERE (dod = '' or dod is null) "
strSql = strSql & " AND p.schoolid = " & Session("schoolid")
when I do a response.write, the SQL statement reads "AND p.schoolid = <blank> " so the Session variable is not being passed/set.
So,
1. Do I need to pass the session variable as a hidden field?
2. What's the best way to pass a session variable from one page to the next
3. Can I use a Session variable if the resultant recordset returns more than one record but ALL values in the field I will use as the Session variable are unique?
Thanks