Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Save output from WHILE WEND to string

Posted 28 Sep 2004 18:10:59
1
has voted
28 Sep 2004 18:10:59 Rene Bandsma posted:
Please take a look on the following code:

<pre id=code><font face=courier size=2 id=code>
DeWebwinkel_Index = 0
while (NOT eCart_EOF(DeWebwinkel))
DeWebwinkel_Index = DeWebwinkel.DisplayIndex - 1
DIM A
A = Array(eCart_DisplayInfo(DeWebwinkel, "Id" & ","
Response.Write(A(0))
set DeWebwinkel= eCart_MoveNext(DeWebwinkel)
wend
set DeWebwinkel= eCart_MoveFirst(DeWebwinkel)
</font id=code></pre id=code>

I want to use the "response.write(A(0))" outside the codeset. When I use Response.Write(A(0)) below the WEND code ASP returns only the latest number (Id). How can I use the same results what I get from the first Response.Write(A(0))????

Please help... i have no idea!

Replies

Replied 29 Sep 2004 15:48:18
29 Sep 2004 15:48:18 Lee Diggins replied:
Hiya

Not sure what's happening here, looks like you only have one element in your array - element 0.

Give me some more info.

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 30 Sep 2004 00:08:33
30 Sep 2004 00:08:33 Rene Bandsma replied:
True, I didn't know how to put the code in an array but I've found the solution:

<pre id=code><font face=courier size=2 id=code>
dim ar(),i
i=0
while (NOT eCart_EOF(DeWebwinkel))
DeWebwinkel_Index = DeWebwinkel.DisplayIndex - 1
redim preserve ar(i)
ar(i) = eCart_DisplayInfo(DeWebwinkel, "Id"
set DeWebwinkel= eCart_MoveNext(DeWebwinkel)
i = i + 1
wend
set DeWebwinkel= eCart_MoveFirst(DeWebwinkel)
</font id=code></pre id=code>

Everything works fine now! But really thanks for your answer.

Reply to this topic