469,646 Members | 1,298 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

Subscript out of range: 'ticker' ?????

Hi, I have the following asp in my page, but I keep getting the
following error

Microsoft VBScript runtime error '800a0009'

Subscript out of range: 'ticker'

Please can you help me ?. Here is the page code I have so far:
---------------------------------
<%
Randomize
R=clng(1E6*rnd)
F=1+clng(1E3*rnd)

Dim RS_rand
Set RS_rand = Server.CreateObject("ADODB.Recordset")
RS_rand.ActiveConnection = conn_string
RS_rand.Source = "SELECT TOP 2 * FROM products WHERE product_New = 1
ORDER BY ((product_ID * " & F & "+" & R & ")Mod 1000);"
RS_rand.CursorType = 0
RS_rand.CursorLocation = 2
RS_rand.LockType = 1
RS_rand.Open()

Dim prodArray(3,2)
ID_CODE = 0
THUMB_CODE = 1
DESC_CODE = 2
URL_CODE = 3

ticker = -1

If NOT (RS_rand.EOF) OR NOT(RS_rand.BOF) then
While NOT RS_rand.EOF
ticker = ticker + 1

prodArray(ID_CODE, ticker) = RS_rand("product_ID")
prodArray(THUMB_CODE,ticker) = RS_rand("product_Thumb")

p_desc = RS_rand("product_Description_2")
if IsNull(p_desc) then
p_desc = RS_rand("product_Description")
end if
if (Len(p_desc) >= 60 ) then
space_pos = InStr(120, p_desc, " ") - 1
p_desc = Left(p_desc, space_pos) & "..."
end if
prodArray(DESC_CODE,ticker) = p_desc

Set RS_URL = Server.CreateObject("ADODB.Recordset")
RS_URL.ActiveConnection = conn_string
SQL = "SELECT category_URL FROM categories WHERE category_ID = " &
RS_rand("category_ID")
RS_URL.Source = SQL
RS_URL.Open()

prodArray(URL_CODE,ticker) = RS_URL("category_URL")

RS_URL.Close()
Set RS_URL = Nothing
RS_rand.MoveNext
WEnd
End If

RS_rand.Close()
Set RS_rand = Nothing

' Super. We have the info in our array. Now let's make the html:
Dim RandomBox(3)
for i = 0 to ticker step 1
RandomBox(i) = "<div class=""imgholder""><img
src=""../product-images/" & prodArray(THUMB_CODE,i) & """ alt=""""
width=""125"" /></div>"
RandomBox(i) = RandomBox(i) & "<a href=""../" & prodArray(URL_CODE,i)
& "/product.asp?ID=" & prodArray(ID_CODE,i) & """>" &
prodArray(DESC_CODE, i) & " <span class=""obvious"">read more<i>
&raquo;</i></span></a>"
next

%>

------------------------------

Thanks so much

David

Mar 1 '06 #1
1 1954

"David" <go********@googlemail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hi, I have the following asp in my page, but I keep getting the
following error

Microsoft VBScript runtime error '800a0009'

Subscript out of range: 'ticker'

Please can you help me ?. Here is the page code I have so far:
---------------------------------

<snip/>


Can't see anything obvious. Which Database are you using? It looks like
you are doing a lot of work in Script that you should be doing in SQL
instead resulting a much simpler ASP.
Mar 2 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

51 posts views Thread by Pedro Graca | last post: by
6 posts views Thread by josh | last post: by
6 posts views Thread by Andy | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.