Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Subscript out of range error
Old 04-20-2007, 07:43 AM Subscript out of range error
aeuden's Avatar
Novice Talker

Posts: 14
Trades: 0
Hi - the code below used to work but now doesn't not sure what is happening.

On on the line in question I have tried replacing the count variable with a number 0, 1, 2 and still end up with the same result, all of these are within the correct range.

Cheers in advance Alun

details=Request.Cookies("cart_contents")
Response.Write("details="&details&"<p>")
detail_split=Split(details,"<br>")

detail_count=Ubound(detail_split)
Response.Write("detail_count="&detail_count&"<br>" )
detail_lbound=Lbound(detail_split)
Response.Write("detail_lbound="&detail_lbound&"<br >")

FOR count=0 TO detail_count-1
product_name=Split(detail_split(count),"£")
Response.Write("count="&count&"<br>")
*****Response.Write("product_name="&product_name(c ount)&"<br>")


*****This line throws up a 'subscript out of range error'

The output is the following

details=
(L200 002 NFEF) 0.20 kW 1.40 AMP sph £115 Q1
detail_count=2
detail_lbound=0
count=0



Ignore this bit I Can





£ count=1



aeuden is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-20-2007, 10:26 AM Re: Subscript out of range error
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
well it probably would

it's not very likely that your product_name Array will be the same size as detail_split Array.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-20-2007, 12:32 PM Re: Subscript out of range error
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
You're splitting an array value.

Try product_name (0, 0) and see what you get.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 04-20-2007, 12:46 PM Re: Subscript out of range error
aeuden's Avatar
Novice Talker

Posts: 14
Trades: 0
I'm still getting the same error but i can see what your getting at.
aeuden is offline
Reply With Quote
View Public Profile
 
Old 04-20-2007, 12:53 PM Re: Subscript out of range error
aeuden's Avatar
Novice Talker

Posts: 14
Trades: 0
Just spotted the first line of my database if blank - I think this may be causing the problem
aeuden is offline
Reply With Quote
View Public Profile
 
Old 04-20-2007, 01:32 PM Re: Subscript out of range error
aeuden's Avatar
Novice Talker

Posts: 14
Trades: 0
OK sorted it I bypassed the blank line in the database and started with count=1 and everything now works. Not sure how to get rid of the blank line though. I'll have to wade through some more code to find out why it's there.

Thanks for the help.

Alun
aeuden is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Subscript out of range error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16280 seconds with 12 queries