If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Assay help !!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-04, 05:56
gop373 gop373 is offline
Registered User
 
Join Date: Aug 2004
Posts: 77
Array help !!

I have some problem about Array. This is the code that I have a problem.

<%sql="select top 5 * from Microsoft order by ti desc"
set rst5=server.createobject("adodb.recordset")
rst5.open sql,conn,1,3
dim i,price(4)
for i=0 to 4
do while not rst5.eof
price(i)=rst5("price")
response.write "price"&i&"&nbsp;"&price(i)&"<br>"
rst5.movenext
loop
next%>


The result after I run my code is

price0 20
price0 13
price0 18
price0 24
price0 17

But I want the result to be like this

price0 20
price1 13
price2 18
price3 24
price4 17

Last edited by gop373; 09-15-04 at 07:03.
Reply With Quote
  #2 (permalink)  
Old 09-15-04, 06:43
RBARAER RBARAER is offline
Registered User
 
Join Date: Aug 2004
Location: France
Posts: 754
Hello,

Your "do while" only works for i=0.

Try this :

Code:
<%sql="select top 5 * from Microsoft order by ti desc"
set rst5=server.createobject("adodb.recordset")
rst5.open sql,conn,1,3
dim i,price(4)
i = 0
do while not rst5.eof 
price(i)=rst5("price") 
response.write "price"&i&"&nbsp;"&price(i)&"<br>"
rst5.movenext
i = i + 1
loop
next%>
Regards,

RBARAER
Reply With Quote
  #3 (permalink)  
Old 09-15-04, 07:05
gop373 gop373 is offline
Registered User
 
Join Date: Aug 2004
Posts: 77
Unhappy

I tried your code. But it did not work.
I got the messeage "


HTTP 500 - Internal server error
Internet Explorer "
Reply With Quote
  #4 (permalink)  
Old 09-15-04, 07:10
gop373 gop373 is offline
Registered User
 
Join Date: Aug 2004
Posts: 77
Thumbs up

It works Now !!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On