Forums

ASP

This topic is locked

Need help with arrays

Posted 30 Jan 2003 22:02:46
1
has voted
30 Jan 2003 22:02:46 Chris Rowe posted:
I have a page that splits an array into a drop down menu to choose sizes for a product. Some products have 4 sizes others have 10 sizes available. It works fine as is, but as soon as I apply the UltraCart II behavior to the page and test it on a browser I get this error message:

Microsoft VBScript runtime error '800a000d'
Type mismatch
/alphadog/products/detail.asp, line 9
=================================================
Line 9 is this:

UCII_CartColNames = Array("ProductID","Quantity","Name","Price","Total"
===================================================
The drop down code is this:
<pre id=code><font face=courier size=2 id=code>
&lt;select name="ProdSize" id="ProdSize"&gt;
&lt;%
Dim Array
Dim iArrayLength, i

Array = Split( rsProdDetail("ProdSize1", ","
iArrayLength = UBound(Array)

For i = 0 to iArrayLength
Response.Write("&lt;option value=" & Array(i) & "&gt;" & Array(i) & "&lt;/option&gt;" & vbCr)
Next
%&gt;
&lt;/select&gt;

==================================================


Here's the code for the entire page as well:

&lt;!--#include file="Connections/connCafeRioStore.asp" --&gt;
&lt;!--#include file="UCII_Cart.asp"--&gt;
&lt;%
' UltraDev Shopping Cart II
' Copyright (c) 2001 Joseph Scavitto All Rights Reserved
' www.thechocolatestore.com/ultradev
Dim UCII_CartColNames,UCII_ComputedCols,UCII__i
UCII_CartColNames = Array("ProductID","Quantity","Name","Price","Total"
UCII_ComputedCols = Array("","","","","Price"
Set UCII = VBConstuctCart("UCartII",0,UCII_CartColNames,UCII_ComputedCols)
UCII__i = 0
%&gt;
&lt;%
Dim rsProduct
Dim rsProduct_numRows

Set rsProduct = Server.CreateObject("ADODB.Recordset"
rsProduct.ActiveConnection = MM_connCafeRioStore_STRING
rsProduct.Source = "Select ProdID, ProdName, ProdPrice, ProdSize1, ProdColor From Products"
rsProduct.CursorType = 0
rsProduct.CursorLocation = 2
rsProduct.LockType = 1
rsProduct.Open()

rsProduct_numRows = 0
%&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form name="form1" method="post" action=""&gt;
&lt;table width="400" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;%=(rsProduct.Fields.Item("ProdName".Value)%&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;%=(rsProduct.Fields.Item("ProdPrice".Value)%&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;%=(rsProduct.Fields.Item("ProdID".Value)%&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;select name="ProdSize" id="ProdSize"&gt;
&lt;%
Dim Array
Dim iArrayLength, i

Array = Split( rsProduct("ProdSize1", ","
iArrayLength = UBound(Array)

For i = 0 to iArrayLength
Response.Write("&lt;option value=" & Array(i) & "&gt;" & Array(i) & "&lt;/option&gt;" & vbCr)
Next
%&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
rsProduct.Close()
Set rsProduct = Nothing
%&gt;
</font id=code></pre id=code>

Is there a problem using "array" twice? Any suggestions? Thank you.

Edited by - crowe on 30 Jan 2003 22:03:45

Replies

Replied 30 Jan 2003 23:26:23
30 Jan 2003 23:26:23 asp asp replied:
seems to me you chould set the vars for line 9 and 10,

DIM UCII_CartColNames = Array("ProductID","Quantity","Name","Price","Total"

DIM UCII_ComputedCols = Array("","","","","Price"
Replied 31 Jan 2003 02:54:55
31 Jan 2003 02:54:55 Chris Rowe replied:
I'm sorry...what do you mean exactly?
Replied 31 Jan 2003 05:11:50
31 Jan 2003 05:11:50 asp asp replied:
sorry i see it is declared as a var in the line before, and yes you can have more then one array on a single page, about your error message USUALLY that results because the types of information accepted in the database
do not coincide with the variables transferred in. Look at the database again and determine what variable types it will accept and the variables transferred in. hope this helps
Replied 31 Jan 2003 06:01:57
31 Jan 2003 06:01:57 Chris Rowe replied:
ASP,
Thanks for replying. I'm still not sure what you are refering to though. I'm using an Access database and the field in question is set to "Text". The values are stored in the database like this "S,M,L,XL,XXL". Is this what you are talking about?

Reply to this topic