A while ago, Aparajita had mentioned that to buffer RowSets in the
session, we should use the "collection to BLOB" and "BLOB to collection"
commands, since a RowSet is just a collection. However, I seem to be
missing something in my test code below when I tried it out:
 
<%
            import("RowSet")
 
            if (session has("MyRs") = true)
                        // RowSet is buffered - pull it from the session
                        $rs := BLOB to collection(session{"MyRs"})
            else
                        // RowSet is not buffered - load it for the
first time and buffer it to the session
                        array text($FNames; 0)
                        array text($LNames; 0)
            
                        set array($FNames; "John"; "Jane";     "Susie")
                        set array($LNames; "Doe";  "Biltmore"; "Q")
 
                        $rs := RowSet.NewFromArrays("First;$FNames;
Last;$LNames")
 
                        session{"MyRs"} := collection to BLOB($rs)
            end if
 
            // Print the RowSet
            RowSet.BeforeFirst($rs) // "Invalid collection handle" is
raised here when the RS is created from the session BLOB
            while (RowSet.Next($rs))
                        writebr(RowSet.GetData($rs; "Last") + ", " +
RowSet.GetData($rs; "First"))
            end while
%>
 
The first time the page is loaded, the RowSet is created from test data;
the next time around, the RowSet is pulled from the session. However,
when the RowSet is pulled directly from the session, I get an "Invalid
collection handle" error within the RowSet.BeforeFirst method.
 
Anyone have any ideas?
 
Regards,
 
David Valles
Pensacola Christian College
 

Reply via email to