[thelist] Quickie ASP question
Scott Dexter
sgd at ti3.com
Thu, 23 Dec 1999 01:09:36 -0600
The OEM Dictionary object ain't free threaded, Anthony, so this is a Bad
Thing(tm)...
But, you'd do it by:
<% Set Session("One") = DictOne ' Set !! %>
but like I (and the docs) say, not a good thing.
But, there's hope for you! Head over to
http://www.caprockconsulting.com/comsoftware.htm --They have a (FREE!)
thread safe Dictionary object built specifically to replace the OEM
dictionary with IIS. There's also a Vector and some other (FREE!) goodies.
I've had great luck and performance with their Dictionary, here are a couple
caveats when working with it:
(1) Keys are *caSE SensiTIvE*:
dctOne("Key1") and dctOne("KEY1") are *NOT* the same thing!
(2) assignment from recordsets are funky:
If you assign to a key like this:
<%
dctOne("firstname") = objRS("firstname") ' <==objRS is an ADO recordset
%>
You'll need to cast it because I've learned that the Dictionary object grabs
it by reference, and my recordset was hosed after the assignment. Do this
instead:
<%
dctOne("firstname") = CStr(objRS("firstname"))
%>
or this simple loop I use to assign values using their column names for the
keys:
<%
' open the recordset specifying your columns in the select statement then:
if (RS.BOF and RS.EOF) then ' Verification Failed
' nothing in it, do something
else
for each fld in RS.Fields
dctOne(fld.name) = fld.value
Next
end if
%>
then you can do:
<%
Set Session("One") = dctOne
Set dctOne = Nothing
%>
and you're gold ....
sgd
--
think safely
> -----Original Message-----
> From: Anthony Baratta [mailto:Anthony@Baratta.com]
> Sent: Wednesday, December 22, 1999 7:49 PM
> To: thelist@lists.evolt.org
> Subject: [thelist] Quickie ASP question
>
>
> I want to store a Dictionary Object into a Session. Is there
> a way to do
> that without going through each key?