Forum Moderators: open

Message Too Old, No Replies

VBScript runtime error '800z0009'

Need help with sudden occurrence

         

Dragonscar

7:26 pm on Apr 20, 2006 (gmt 0)

10+ Year Member



I have a site wtih a login page using an array. It worked just fine until yesterday, when I simply made an addition to the array (the array consists of a simple text file with a list as follows:
username¦password¦location

Error as follows:

Microsoft VBScript runtime error '800a0009'

Subscript out of range: '[number: 1]'

/Pages/login.asp, line 34

Line 34 is
c_password = line_array(1)

Any idea why this might have suddenly occurred? I have tried removing the line added, but the error persists.

Thanks for any help.

txbakers

9:00 pm on Apr 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi and welcome to the webmaster world.

it could be that there is a null value in one of the array elements, or there is no data for that particular set.

duckhunter

1:56 pm on Apr 21, 2006 (gmt 0)

10+ Year Member



'Subscript out of range' means you are asking for an item in the array that doesn't exist. Arrays are zero based so the first item is (0) instead of (1).

Try:

c_password = line_array(0)

Dragonscar

2:45 pm on Apr 21, 2006 (gmt 0)

10+ Year Member



Thanks DuckHunter,

Actually here is the full section:

' Separate the line into username and password
line_array = Split(line,"¦")
c_username = line_array(0)
c_password = line_array(1)
c_address = line_array(2)

And here is a sample from the file it refers to:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<PRE>mike¦merlin¦testsite1
jopage¦jopage¦testsite2<PRE>

duckhunter

9:27 pm on Apr 22, 2006 (gmt 0)

10+ Year Member



Try a Response.write on your variable 'line' before the Split command.

line_array = split("mikeŠmerlinŠtestsite1ŠjopageŠjopageŠtestsite2","Š")

merlin should be at line_array(1)

If you are not getting a value in line_array(1) then your array probably didn't get populated as you thought it may have.

Dragonscar

4:00 pm on Apr 24, 2006 (gmt 0)

10+ Year Member



Thanks to all who tried to help me. This turned out to be a very silly error. I opened the file with the information in FrontPage, which threw some unnecessary and incongruent HTML code into my simple text file. As a result, it was trying to read it incorrectly.

I feel very dumb at the moment and apologize for any inconvenience.

Thanks again.

Laura