Forums

ASP

This topic is locked

variable within a variable

Posted 23 Jan 2002 04:23:10
1
has voted
23 Jan 2002 04:23:10 Travis Brown posted:
Probably an easy question; however, I've had enough for today.
I have a local variable "I" that I want to insert in a variable in a FOR/NEXT loop:

<td nowrap><%=(rsWTS_1.Fields.Item("wts".Value)%></td>

I want to replace the "1" with the variable "I"

Anyone care to help with the syntax? I'm sure I've done it before, but I'm having a bit of a menltdown, er, meltdown.

Replies

Replied 23 Jan 2002 12:09:46
23 Jan 2002 12:09:46 Joel Martinez replied:
no that wouldn't work because you can't use a string as an object name... if the code you are trying to do actually worked, that would mean that you would have to have a bunch of recordsets: rsWTS_1,rsWTS_2,rsWTS_3, etc.

you could however use the method you are talking about to loop through the fields:
<td nowrap><%=(rsWTS_1.Fields.Item("wts_" & i).Value)%></td>

Joel Martinez [ ]
----------
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/

Reply to this topic