Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2005, 11:32 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default Subscript out of range

What type of error is this:

Error Type:
Microsoft VBScript runtime (0x800A0009)
Subscript out of range: '[number: 0]'
/Public/asp/search.asp, line 134


____

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>







<link rel="stylesheet" type="text/css" href="../includes/style.css">
<title>Template</title>
<SCRIPT LANGUAGE="JScript">

if (document.images)
{
   img1 = new Image();
   img2 = new Image();
   img1.src = "images/up.gif";
   img2.src = "images/down.gif";
}

function moveUp(cD)
{
    var x=document.getElementById(cD);
    var tpPos=x.offsetTop
    var obHgt=x.offsetHeight
    offst=tpPos - obHgt
     var y=document.getElementById('u'+cD);
  y.innerHTML = '';
     var z=document.getElementById('t'+cD);
  z.innerHTML = '&nbsp;< Retract';
    x.style.visibility="visible"
    up(tpPos, offst, cD)
}

function up(spot, offst, cD)
{
     var x=document.getElementById(cD);
  if (spot!=offst)
    {
      x.style.top=spot;
      spot-=1;
      setTimeout('up('+spot+','+offst+','+cD+')',1);
     }
    else
    {
      var y=document.getElementById('d'+cD);
         y.innerHTML = '<img src="images/down.gif" border="0" align="middle" width="15px" height="15px" alt="Retract fare info." />';
    }
}

function moveDown(cD)
{
    var x=document.getElementById(cD);
    var tpPos=x.offsetTop
    var obHgt=x.offsetHeight
    offst=tpPos + obHgt
     var y=document.getElementById('d'+cD);
  y.innerHTML = '';
     var z=document.getElementById('t'+cD);
  z.innerHTML = '&nbsp;< Expand';
    down(tpPos, offst, cD)
}

function down(spot, offst, cD)
{
      var x=document.getElementById(cD);
    if (spot!=offst)
      {
        x.style.top=spot;
        spot+=1;
        setTimeout('down('+spot+','+offst+','+cD+')',1);
       }
        else
        {
      var y=document.getElementById('u'+cD);
         y.innerHTML = '<img src="images/up.gif" border="0" align="middle" width="15px" height="15px" alt="Expand fare info." />';
             x.style.visibility="hidden"
        }
}
function passnextpage(FN)
{
document.form.flight_no.value=FN;
document.form.submit();
}


</script>

<%

response.write "oneret = " & request.form("oneret") & "<br>"
response.write "depapt = " & request.form("depapt") & "<br>"
response.write "depday = " & request.form("depday") & "<br>"
response.write "depmonth = " & request.form("depmonth") & "<br>"
response.write "deptm = " & request.form("deptm") & "<br>"
response.write "retday = " & request.form("retday") & "<br>"
response.write "retmonth = " & request.form("retmonth") & "<br>"
response.write "rettm = " & request.form("rettm") & "<br>"
response.write "class = " & request.form("class") & "<br>"
response.write "airline = " & request.form("airline") & "<br>"
response.write "noa = " & request.form("noa") & "<br>"
response.write "noc = " & request.form("noc") & "<br>"
response.write "noi = " & request.form("noi") & "<br>"

sid = session.SessionID
journey = trim(request.form("oneret"))
depApt = trim(request.form("depapt"))
ariApt = trim(request.form("ariapt"))
depDay = trim(request.form("depday"))
depYrMnth = split(trim(request.form("depmonth")), "#")
depTm = trim(request.form("deptm"))
retDay = trim(request.form("retday"))
retYrMnth = split(trim(request.form("retmonth")), "#")
retTm = trim(request.form("rettm"))
airLine = trim(request.form("airline"))
cabin = trim(request.form("class"))
noa = trim(request.form("noa"))
noc = trim(request.form("noc"))
noi = trim(request.form("noi"))
Select Case cabin
Case "1"
    cabinClass = "F"
Case "2"
    cabinClass = "C"
Case "3"
    cabinClass = "Y"
end select

if len(depDay) = 1 then
     depDay = "0" & depDay
end if
depYr = right(depYrMnth(0), 2)
depMnth = depYrMnth(1)
if len(depMnth) = 1 then
     depMnth = "0" & depMnth
end if
CStr(depMnth)
depMnth = setdate_rev(depMnth)
depDte = depDay & depMnth & depYr
response.write "depDte = " & depDte & "<br>"

if len(retDay) = 1 then
     retDay = "0" & retDay
end if
retYr = right(retYrMnth(0), 2)
retMnth = retYrMnth(1)
if len(retMnth) = 1 then
     retMnth = "0" & retMnth
end if
CStr(retMnth)
retMnth = setdate_rev(retMnth)
retDte = retDay & retMnth & retYr
response.write "retDte = " & retDte & "<br>"
%>



<%
  'Create XML
  set objxml=server.CreateObject("MSXML2.FreeThreadedDOM Document")
  objxml.async = 0
      'Load XML
    if not objxml.load(Server.MapPath("includes/MPReplyExample.xml")) then
    response.write objxml.parseerror.reason
    response.end
    end if
%>
</head>
<body>
<table width="750" bgcolor="#003366" border=1 align="center">
<tr>
<td height="70" bgcolor="#003366" align="left">
<img src="images/mackheader2.gif" height="70px" width="150px">
</td>
<td height="70" bgcolor="#003366" align="right">
<img src="images/mack_login.gif" height="70px" width="215px">
</td>
</tr>
<tr>
<td colspan="2" height="20" align="center">
<div class="font4">menu</div>
</td>
</tr>
<td colspan="2">
        <div style="z-index:0; position:relative;">
      <table border=0 width="100%" bgcolor="#003366">
                <tr><td>&nbsp;</td></tr>
                <tr><td>&nbsp;</td></tr>
      </table>
            </div>
<%
        'Loop for Departure segment and Arrival Segment
        l = objxml.documentelement.selectnodes("Recommendation ").length -1
        zId = 1
    for i = 0 to l
          set node = objxml.documentelement.selectnodes("Recommendation ").item(i)
            zIl = (i + 1) * 3
            zId = zIl - 2
            zI = zIl - 1
%>

        <form name="form">


        <input type="hidden" name="flight_no">
        </form>
            <img src="asp/images/fareSearch.gif" align="middle" name="netfares" width="80" height="15" border="0" id="searchbyfare" onClick="window.location.href='finish.asp';" tabindex="10" title="Search for Mackenzie Fares">
</td>
</tr>
</table>
</body>
</html>


www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old March 21st, 2005, 06:45 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right. You don't expect us to count your lines, do you? How about you tell us what line 134 is. Or better yet, mark it with some comments or a different color. Or even better: just post the lines surrounding the offending code so we can focus on the true problem without scrolling through zillions lines of code.

Or yet even better: Google. I asked you this before, but do you even Google before you post here? 89% of the questions you asked on this forum are in the "how to ...." format, that can be answered by Google in a split second.

I don't mind helping people on this forum, but I do mind looking at questions that you can answer for yourself if you took the time to figure them out.....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 22nd, 2005, 07:43 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

its hard to find line number line 134, as there are includes. i just wanted to know generally what the error was....

:-)

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
 
Old March 22nd, 2005, 07:50 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

sorry Imar

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
 
Old March 22nd, 2005, 06:55 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Finding a line number is fundamentally very important to troubleshooting your code. It’s like a racing car driver not being able to find his keys - it’s very clear, he must find his keys to be in the race.

Have you taken Imar's advice? Google 'Subscript out of range' the answer to your question is on the first result page, in fact the first item:
"An array subscript is not valid because it falls outside the allowable range"


Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
"Subscript out of range" in acFormPivotChart jilly Access VBA 0 April 23rd, 2008 08:52 PM
Array, Subscript out of range. koss77 VB How-To 4 August 21st, 2006 09:35 AM
Subscript out of range: '[number: 0]' jim_h Classic ASP Professional 0 February 24th, 2006 07:24 PM
Subscript out of range rfrancisco Classic ASP Components 1 February 13th, 2006 08:25 PM
Problem of "Subscript out of range " liorlank Classic ASP Components 2 November 26th, 2003 10:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.