Results 1 to 4 of 4

Thread: Assay help !!

  1. #1
    Join Date
    Aug 2004
    Posts
    77

    Unanswered: 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 08:03.

  2. #2
    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

  3. #3
    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 "

  4. #4
    Join Date
    Aug 2004
    Posts
    77

    Thumbs up

    It works Now !!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •