[thelist] Quickie ASP question

Scott Dexter sgd at ti3.com
Thu, 23 Dec 1999 01:39:40 -0600


copying you directly cause my email server has been *real* lazy in getting
out evolt mail the past week:

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?

sgd
--
think safely

> -----Original Message-----
> From: Anthony Baratta [mailto:Anthony@Baratta.com]
> Sent: Thursday, December 23, 1999 1:36 AM
> To: thelist@lists.evolt.org
> Subject: Re: [thelist] Quickie ASP question
> 
> 
> Will this work the way I think??? It does not throw an error....
> 
>   Session("BlahBlah") = DictBlahBlah.Items
> 
> Then later I can put the info back into the Dictionary object.....
> (This is a guess here.....)
> 
>   DictBlahBlah.Items = Session("BlahBlah")
> 
> I'm trying stuff the WHOLE dictionary object into a Session 
> object with one line. I
> can do this will an XML object - but would prefer at this 
> point to use a Dictionary
> Object.
> 
> -- 
> Anthony Baratta
> President
> KeyBoard Jockeys
>                     South Park Speaks Version 3 is here!!!
>                        http://www.baratta.com/southpark
>                               Powered by Tsunami
> 
> _______________________________________________________
> unsubscribe+options: http://lists.evolt.org/mailman/listinfo/thelist
> tip harvester: http://lists.evolt.org/harvest/
> email archive: http://lists.evolt.org/archive/
> http://evolt.org/  Workers of the Web, evolt !
>