[thelist] asp array into variables

Tab Alleman Tab.Alleman at MetroGuide.com
Wed Aug 13 09:21:09 CDT 2003


Paul Cowan wrote:
> Darren wrote:
> This is failing because when you do the GetRows, you're getting
> out an array with only 1 'column', if you like, and any number
> of rows.
> 
> When you do this:
>>   ImgSrc1 = tbValues(1, i)
> 
> You're saying 'the second column (index 1) of row i'. Row i (initially
> 0, the first row) doesn't HAVE a second column... just the one.

Noooooooooooooo.... GetRows always returns a 2d array.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/
htm/mdamth02_10.asp

I believe what you need to do is:

For i = 0 To (UBound(tbValues, 2) - 1)

Cause Ubound returns the number of items in that dimension of the array,
but the actual array index is 0-based.  If you do:

Dim AnArray(4)

Then Ubound(AnArray) will equal 4, but you can only populate AnArray(0)
thru AnArray(3).  If you try to read AnArray(4), you'll get your
out-of-bounds error.



More information about the thelist mailing list