I've got an issue I don't understand. I have an asp page where I set a session variable as a recordset, for the purposes of having other asp pages read what I'd expect to be the same data. It does not work this way, and I'm wondering if anyone can help here.
First, in the Session.On_start of global.asa, I do
set session("globalrs") = server.createobject("adodb.recordset")
Then, in Page1.asp I do (pseudocode):
(above is a dll that returns an ado recordset. It works fine)
Then, I loop through that set:
Now, in Page2.asp (the src of the above Iframe), I have:
Now...I may have typos above and it's pseudocode, so please ignore that, because everything works EXCEPT:
The list of iframes printed out shows (assume 5 records in table, and 2 fields):
Record: 1 I'm Record 1 Field1 I'm Record 1 Field2
Record: 2 I'm Record 1 Field1 I'm Record 1 Field2
Record: 3 I'm Record 1 Field1 I'm Record 1 Field2
Record: 4 I'm Record 1 Field1 I'm Record 1 Field2
Record: 5 I'm Record 1 Field1 I'm Record 1 Field2
So basically, session("globalrs") get's a valid set of 5 records, and page1 loops through them fine. But in Page2.asp, session("globalrs") is always on record 1!! Why is this? If it's the same as in page 1, then it should be on the same record as Page1.asp in the loop. The loop is going fine, and the record ordinal num (iRecNum) is passed fine to Page2.asp, and the recordset is read properly in Page2.asp, but it's the same first record. What is up with that?
--J
First, in the Session.On_start of global.asa, I do
set session("globalrs") = server.createobject("adodb.recordset")
Then, in Page1.asp I do (pseudocode):
Code:
set rs = myDataClass.GetRecset()
set session("globalrs") = rs
Then, I loop through that set:
Code:
Do until session("globalrs").eof
iRecNum = iRecNum + 1
response.write "<iframe src=Page2.asp?rec=" & iRecNum & ">"
session("globalrs").movenext
loop
Code:
iRecNum = Request("rec")
response.write "Record: " & iRecNum
for i = 0 to session("globalrs").fields.count -1
session("globalrs").fields(i)
next
Now...I may have typos above and it's pseudocode, so please ignore that, because everything works EXCEPT:
The list of iframes printed out shows (assume 5 records in table, and 2 fields):
Record: 1 I'm Record 1 Field1 I'm Record 1 Field2
Record: 2 I'm Record 1 Field1 I'm Record 1 Field2
Record: 3 I'm Record 1 Field1 I'm Record 1 Field2
Record: 4 I'm Record 1 Field1 I'm Record 1 Field2
Record: 5 I'm Record 1 Field1 I'm Record 1 Field2
So basically, session("globalrs") get's a valid set of 5 records, and page1 loops through them fine. But in Page2.asp, session("globalrs") is always on record 1!! Why is this? If it's the same as in page 1, then it should be on the same record as Page1.asp in the loop. The loop is going fine, and the record ordinal num (iRecNum) is passed fine to Page2.asp, and the recordset is read properly in Page2.asp, but it's the same first record. What is up with that?
--J