SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 30th, 2003, 10:05 AM
jdailey jdailey is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 jdailey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Type mismatch

I pass session variables in a querystring to another page, which increments an array and adds them to it. This had been working absolutley fine on my local machine and I uploaded the scripts to a remote server. Everything worked fine (and still does) on the remote server.

I then decided to try opening the script that receives the querystring in a popup with javascript window.open, to display the results in the popup instead of a full new page as before.

When I tried this I got a Type Mismatch on the receiving page. I hadn't changed any of the code in any of the pages apart from calling the receiving page with window.open, so I thought it just didn't like being called/opened that way. So I removed the window.open and went back to the old way - and I still get the Type Mismatch. I couldn't see why it was throwing this now, so I downloaded the scripts from the remote server (which work fine) to my local machine and I still get the Type Mismatch on the local machine. I tried stopping and starting IIS and then rebooting, but to no avail. It still works remotely but not locally.

The mismatch is occuring apparently between the String I'm trying to add to the array and the array index (which is also a session variable):

Here's the code in question:

pitem = Request.QueryString("fpItem")

Dim tmpArray

tmpArray = Session("arrItem")
tmpArray(Session("indx")) = pitem
Session("arrItem") = tmpArray
Session("indx") = Session("indx") + 1

The Type Mismatch is occuring here:
tmpArray(Session("indx")) = pitem

If this shouldn't have worked some reason before, that's OK, but why does it still work fien on the remote server?

Neddles to say, any suggestions would be greatly appreciated!

Reply With Quote
  #2  
Old August 30th, 2003, 10:34 AM
nopoints nopoints is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Windsor ON, Canada
Posts: 459 nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 44 m 22 sec
Reputation Power: 8
i think Session will return a variant data type which is used rather often (unfortunately) in ASP. however, an index of an array is an Integer so you should always explicitly convert to the data type you need.
Code:
tmpArray(CInt(Session("indx"))) = pitem

see if that solves the problem. if not make sure that Session("indx") has a value.
__________________
Programmer's Corner

Reply With Quote
  #3  
Old August 30th, 2003, 11:59 AM
jdailey jdailey is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 jdailey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I tried CInt to explicitely convert the array index to integer, but still got the Type mismatch. I checked Session("indx") and found that in fact it contained nothing. But your right about explicitely setting varibale types to make for cleaner code as a habit.

Apparently I have an initialization problem. I initialize it in Global.asa with:

Sub Session_OnStart
Session("indx")=0
...
End Sub

This has always worked before. Can I cast a type for the session variable here?

Thank you !

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Type mismatch


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway