Results 1 to 6 of 6

Thread: My Loop

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    10

    Question

    Hi guys,
    I have a loop to write out the contents of my query.

    <%
    do while NOT oRSv.EOF
    Response.Write "<option value='" & oRSv("Date") & "'>"
    Response.Write oRSv("Date") & "</option>&nbsp&nbsp&nbsp"
    Response.Write "<option value='" & oRSv("Step") & "'>"
    Response.Write oRSv("Step") & "</option><br>"

    oRSv.MoveNext


    Loop
    oRSv.Close
    Set oRSv=nothing

    %>


    its in an asp page but its writting out my data 5 times instead of once. because the number of frecords differ everytime I have no way of stopping this.

    Any Ideas?

  2. #2
    Hyperactive Member compuGEEK's Avatar
    Join Date
    May 1999
    Location
    Mpls,MN,USA
    Posts
    281
    Try this:

    Code:
    Do Until oRSv.EOF 
    Response.Write "<option value='" & oRSv("Date") & "'>" 
    Response.Write oRSv("Date") & "</option>   " 
    Response.Write "<option value='" & oRSv("Step") & "'>" 
    Response.Write oRSv("Step") & "</option><br>" 
    oRSv.MoveNext
    Loop

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    10

    still no luck

    nope it didnt work

    thanks anyway


  4. #4
    Addicted Member
    Join Date
    Mar 2001
    Posts
    152

    What are you trying to do?

    You know I read your post and the others and I am not sure what it is you want to do with the code?

    Your code is setup to do a query and then loop through all the results (5, 10, however many) and print them out. If you have 10,000 records and there is no restrictions in your query it will continue to run.

    So what is it you want to see?

  5. #5
    yea... u need to show us your querystring

    also don't forget about Exit Do.
    *urp*

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    10

    resolved

    I was only new to sql server 7 and i imported the data too many times, silly me

Posting Permissions

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



Click Here to Expand Forum to Full Width