Author |
Topic  |
|
giambona
New Member

USA
84 Posts |
Posted - 27 June 2001 : 12:29:04
|
I am getting records from an array in an ASP page and I am getting the following error:
quote:
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '2'
/default.asp, line 441
Does anyone have any idea why? I have tried everything I can think of, but I'm a newbie so i don't know.
Here's my code:
quote:
alldata = rsTemp.GetRows rsTemp.close Set rsTemp = Nothing conntemp.close Set conntemp = Nothing numcols = ubound(alldata, 1) numrows = ubound(alldata, 2) Response.Write numrows strDate = FormatDateTime(Date, 1) Response.Write "<p align=""center""><b><font face=""Arial"" color=""#f0c807"" size=""3""><u>" & strDate & "</u></font></b>" For Counter = 0 To numcols Response.Write Counter strLink = alldata(3, Counter) strTitle = alldata(1, Counter) strPoster = alldata(4, Counter) strDesc = alldata(2, Counter) Response.Write "<p><b><a href=""" & strLink & """><font size=""2"" color=""#006699"" face=""Arial"">" & strTitle & "</font></a></b><br>" Response.Write "<font face=""Arial"" size=""1"" color=""#000000"">(Posted by: <a href=""mailto:" & strPoster & """>" & strPoster & "</a>)</font><br>" Response.Write "<font face=""Arial"" size=""2"" color=""#000000"">" & strDesc & "</font></p>"
Next
Thanks in advance for any help.
|
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 27 June 2001 : 12:37:36
|
try this....
for i=lbound(alldata) to ubound(alldata) Response.Write alldata(i,0) Response.Write alldata(i,1) Response.Write alldata(i,2) next
quote:
numcols = ubound(alldata, 1) numrows = ubound(alldata, 2) Response.Write numrows
something to keep in mind is that arrays start with 0, not 1
Brad |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 27 June 2001 : 16:26:27
|
Use for counter = 0 to numRows, not numCols.
====== Doug G ====== |
 |
|
giambona
New Member

USA
84 Posts |
Posted - 27 June 2001 : 16:30:19
|
thanks to both of you
after i saw redbrad's post, i tried screwing around with it (i was a little bit confused) and figured it out
|
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 27 June 2001 : 17:01:14
|
quote: for i=lbound(alldata) to ubound(alldata) Response.Write alldata(i,0) Response.Write alldata(i,1) Response.Write alldata(i,2) next
This isn't correct for GetRows()
Assuming i is your row counter, the array is constructed as
alldata(0, i) alldata(1, i)
where the 1st array level is the column number.
====== Doug G ====== |
 |
|
|
Topic  |
|