Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Subscript out of range: 'ticker' ?????

Reply
Thread Tools

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

 
 
David
Guest
Posts: n/a
 
      03-01-2006
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

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      03-02-2006

"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting "vector subscript out of range" error Han C++ 4 11-14-2007 07:13 AM
vector subscript out of range Andy C++ 6 05-11-2007 10:05 AM
Runtime error 9: Subscript out of range Excel 2000 jack.jackson11@gmail.com Computer Support 0 01-20-2006 08:47 PM
out of range array subscript Richard Delorme C Programming 5 05-15-2004 03:42 PM
Run-Time error '9' Subscript out of range normanstrong Computer Support 1 08-12-2003 06:22 PM



Advertisments