Hur gör jag?? jag har testat lite olika varianter av denna kod...:
' ## GET ROW NUMER FROM ALTERNATIVE AND REGION
IF IsArray(allMyAdverts) THEN
' ## intAlternativeID = 8
' ## intRegionID = 9
' ## LOOP THROUGH ALL PERSONAL ADVERTS
' myRow = allMyAdverts
FOR j = 0 TO UBound(allMyAdverts,2)
DIM ["postData_" & j]
["postData_" & j] = "hello! " & j
response.write ["postData_" & j] & "<BR>"
response.write " ** "
NEXT
END IF
Om du vill använda dynamiska variablar, använd Dictionary.
Dim dic, iLoop
Set dic = Server.CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
for iLoop = 1 to 10
dic("variabel" & iLoop) = iLoop
next
Set dic = Nothing
Är du med?
Eller ännu bättre, som din kod vill att det skall fungera:
Dim dic, j
Set dic = Server.CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
for j = 0 to ubound(allMyAdverts,2)
dic("PostData" & j) = "Hello " & j
response.write dic("PostData" & j) & "<br>"
next
Set dic = Nothing