[thelist] asp array into variables

Paul Cowan evolt at funkwit.com
Wed Aug 13 06:02:38 CDT 2003

Darren wrote:
> Results in an error -
> Subscript out of range: '[number: 1]'

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.

This would be more likely to be what you're after, I think:
  ImgSrc = tbValues(0, 0)
  ImgSrc1 = tbValues(0, 1)
  ImgSrc2 = tbValues(0, 2)
  ImgSrc3 = tbValues(0, 3)
  ImgSrc4 = tbValues(0, 4)
(without the for loop)

In which case 'ImgSrc' will contain the value of the "Image" field from
the first row, ImgSrc1 from the second, and so on.

This will crap out if you've got less than 5 rows in your recordset, though,
and won't expand if you've got more than 5. I'm don't know that this is,
in fact, what you're trying to do.

What are you doing with these variables? I'm not 100% sure that what
you're doing is the best way to do it, whatever it is. :)



More information about the thelist mailing list