View Full Version : How to set variables in a loop in asp?
NinjaTurtle
09-15-2004, 09:28 AM
Dear,
for RsCount=1 to 12
strStone+RsCount = request.form("txt_Stone"&RsCount)
Next
i get error on strMileStone+RsCount
i want to get this in ASP within a For Loop:
strStone1 = 1212
strStone2 = 432
strStone3 = 90
.
.
.
strStone12 = 965074
Is that only way i have to use is Array???
BuddhaMan
09-15-2004, 02:05 PM
There could be multiple things wrong and I'm guessing on the way you're trying to do this
strStone(RsCount) = request.form("txt_Stone") & RsCount
I don't know if you can set a variable to the value of a string and an interger. You probably need to do:
strStone(RsCount) = request.form("txt_Stone") & CStr(RsCount)
A better description of what you're trying to do would help things along also.
I suggest you get install the VBScript help file and read thru it --> http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en
allida77
09-15-2004, 03:25 PM
Is that only way i have to use is Array???
Would you really want to keep track of all those variables?
Dim strStone(12)
For RsCount=1 to 12
strStone(RsCount) = request.form("txt_Stone") & RsCount
Next
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.