VERY URGENT: Subscript out of range

Results 1 to 2 of 2

Thread: VERY URGENT: Subscript out of range

  1. #1
    ZZZcln. Guest

    Default VERY URGENT: Subscript out of range

    Hi,<BR><BR>I use a SQL database and the Poll code from this site.<BR>I get the following error message when I try to vote. (if I&#039m not voted already, everything is all right, thus the Conn = OK)<BR><BR>The part of the code:<BR><BR><BR> &#060;% if strVoted = "Yes" then<BR><BR> strSQL = "SELECT PollOption.PollOptionID, PollOption.QuestionText, PollOption.Votes, Poll.PollQuestion, Poll.DateStart, Poll.DateEnd FROM Poll INNER JOIN PollOption ON Poll.PollID = PollOption.PollID WHERE Poll.DateStart &#060;= GETDATE() AND Poll.DateEnd &#062;= GETDATE()"<BR><BR> objRS.Open strSQL, objConn, adLockReadOnly<BR><BR> Dim PollOptions()<BR> Redim PollOptions(objRS.RecordCount,2)<BR><BR> Dim iCount, iTotalVotes, strPollName<BR> iCount = 0<BR> iTotalVotes = 0<BR> <BR> strPollName = CStr(objRS("PollQuestion"))<BR> <BR> Do While Not objRS.EOF<BR><BR>***** (LINE 84) ****** PollOptions(iCount,1) = CInt(objRS("Votes"))<BR> PollOptions(iCount,2) = CStr(objRS("QuestionText"))<BR> <BR> iTotalVotes = iTotalVotes + PollOptions(iCount,1)<BR> iCount = iCount + 1<BR> <BR> objRS.MoveNext<BR> Loop<BR> <BR>%&#062;<BR><BR><BR><BR>The ERROR MESSAGE:<BR><BR>Error Type:<BR>Microsoft VBScript runtime (0x800A0009)<BR>Subscript out of range: &#0390&#039<BR>/pso/poll.asp, line 84<BR><BR><BR>Browser Type:<BR>Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) <BR><BR>Page:<BR>GET /pso/poll.asp<BR><BR><BR><BR>( I marked line 84 with "***** (LINE 84) ****** ")

  2. #2
    Join Date
    Dec 1969

    Default Bill's mantra: DEBUG DEBUG DEBUG

    Have you tried doing<BR><BR>Response.Write iCount & "&LT;BR&#062;"<BR><BR>to see what the value is that is causing the error?<BR><BR>Have you tried doing <BR><BR>Response.Write UBound(PollOptions,1) & ", " & UBound(PollOptions,2) & "&LT;BR&#062;"<BR><BR>to see how big the array is?<BR><BR>A little debugging code can go a long way.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts