ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 30th, 2009, 03:12 AM
Soporose Soporose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 21 Soporose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 54 sec
Reputation Power: 0
Weird behavior with Dictionary Object

Hi folks.

Apparently there is something important about using the Dictionary object that I don't understand, and it's driving me up the wall.

I'm opening a recordset and reading from a MySQL database, with a query like this:
strSQL = "SELECT country,timezone FROM " & oTablename & " WHERE receipt LIKE '%" & oReceipt & "%'"
Then the values returned are stored to a dictionary object like so:
Session("MemberRecord").Add "country", RS.fields("country")
Session("MemberRecord").Add "timezone", RS.fields("timezone")
Then the database cleanup:
RS.close
Set RS = Nothing
oConn.Close
Set oConn = Nothing
For troubleshooting I inserted the following two lines:
Response.write "RS.fields('country') = " & RS.fields("country") & "<br>"
Response.write "Session('MemberRecord')('country') = " & Session("MemberRecord")("country") & "<br>"
Now the problem:

Both of the Response.Writes display the correct value IF those two lines are placed BEFORE the database cleanup.

If placed after the database cleanup, the attempt to write the RS.fields value fails as is to be expected. However, what I can't explain is why printing of the dictionary element also fails at this point. All it returns is:
error '80020009'
/filename.asp, line 160
Where line 160 is the Response.Write.

Surely the contents of the elements of the dictionary object shouldn't be dependent on keeping open the database that its values came from!

And I haven't had any success trying to fathom a reason from that error number.

Can someone PLEASE throw some light on this behavior.

TIA

Reply With Quote
  #2  
Old July 2nd, 2009, 01:36 AM
keep_it_simple's Avatar
keep_it_simple keep_it_simple is offline
KIS
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2007
Location: USA
Posts: 1,530 keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level)keep_it_simple User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 18 h 49 m 10 sec
Reputation Power: 825
Send a message via Yahoo to keep_it_simple
try w/o .add

Code:
   If Len(sTableName) > 0 AND Len(sReceipt) > 0 Then

    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=" & Server.MapPath("database.mdb") & ";"

    Set oRs = oConn.Execute("SELECT country,timezone FROM " & sTablename & " " & _ 
                            "WHERE receipt = '" & sReceipt & "';")

    If Not oRs.EOF Then

     sCountry = oRs("country")
     sTimeZone = oRs("timezone")

     oRs.Close
     Set oRs = nothing
     oConn.Close
     Set oConn = nothing

     Set Session("MemberRecord") = Server.CreateObject("Scripting.Dictionary")

     Session("MemberRecord")("country") = sCountry
     Session("MemberRecord")("timezone") = sTimeZone

    End If
   End If
%>
__________________
Please give respect to those that helped solve an issue by clicking on the reputation icon

Reply With Quote
  #3  
Old July 3rd, 2009, 11:15 PM
Soporose Soporose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 21 Soporose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 54 sec
Reputation Power: 0
I gave up on the dictionary object and took a different approach, as it was taking too long to sort out.

However I'll revisit this in a couple of days and try your suggestion.

So is there a known problem with .Add ???

TIA

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > Weird behavior with Dictionary Object


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
Stay green...Green IT