Forum Moderators: open

Message Too Old, No Replies

Type mismatch problem

Script worked until I changed server!

         

steve

10:51 am on Jun 30, 2005 (gmt 0)

10+ Year Member



I have a very simple shopping cart, which worked until I changed from PWS to IIS5.1.

Now I get ox800a000d type mismatch 'TempArray'

The code is:

Dim objRS' recordset obj
Set objRS = Server.CreateObject ("ADODB.Recordset")' create object
objRS.Open "products", strConnect, adOpenStatic, adLockReadOnly, adCmdTable' and open it

CartItems = Session("CartItems")
TempArray = Session ("Cart")

If Request.QueryString("action") = "add" then

NewCartItems = CartItems + 1

Dim TempArray2 ()
ReDim TempArray2 (NewCartItems,2)

For I = 0 to CartItems
TempArray2 (I,0) = TempArray (I,0) <<<FAILS HERE
TempArray2 (I,1) = TempArray (I,1)
TempArray2 (I,2) = TempArray (I,2)
Next

TempArray2 (NewCartItems, 0) = Request.QueryString("id")
TempArray2 (NewCartItems, 1) = Request.QueryString("quantity")
TempArray2 (NewCartItems, 2) = Request.QueryString("length")
Session ("Cart") = TempArray2
Session ("CartItems") = NewCartItems

Can anyone tell me what the problem is, I assume it has something to do with changing servers?

Jimmy Turnip

2:10 pm on Jun 30, 2005 (gmt 0)

10+ Year Member



It looks like there's a problem with IIS creating or retrieving the session variables because you ReDim TempArray from Session("CartItems").

Have you set up state management correctly? Right click the website in IIS and select properties. Click the home directory tab. Click configuration and then the options tab. Ensure enable session state check box is checked.

steve

8:42 pm on Jun 30, 2005 (gmt 0)

10+ Year Member



Hi Jimmy,

Thanks for the suggestion. I've just checked and the session state box in the default website is ticked. So that's not the cause.

steve

9:37 am on Jul 1, 2005 (gmt 0)

10+ Year Member



Figured it out, thanks for the clue Jimmy.

The global.asa file wasn't being read because I didn't set IIS up to create an application.

As a result, the session variables were not created!