Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: while / if ?

  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Lightbulb while / if ?

    this is a while loop as you see...i need if statment casue if "not rstemp.eof" there will be only one result...how can i wrote this like if?
    Code:
    dim citv, mySQL, conntemp, rstemp
    mySQL="SELECT sonpass,agentcode FROM crmagents WHERE agentcode='" & pagent & "'"
    call getFromDatabase(mySQL, rstemp, "citiess.asp") 
    do while not rstemp.eof
    citv = rstemp("sonpass")
    if ppassw=citv then
    response.write "<BR>all the list goes here" & citv & "------" & ppassw & "<br>"
    else
     response.redirect "agentreg00.asp?message="& Server.Urlencode("you typed wrong password")	
    end if
    
     rstemp.movenext
    loop
    By the time u recognize this moment, This moment will be gone.

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Change "do while" to "if", and put "then" after "eof". Take out "rstemp.movenext" and change "loop" to "end if".


  •  

    Posting Permissions

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