Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need a loop... 1

Status
Not open for further replies.

fergman

Technical User
Oct 19, 2000
91
US
I have a database with a set of numbers.
I'm having one form send the next page a number.
I want the second page to check that number against the
set of numbers in the database. right now all I can get it
to do is verify the very first number in the database.
I'd post code, but my loop is so messy I'm embarrased. :)
anyone think they can bang something out for me?
here is my statement before the loop
dim AUTHENTICATE
AUTHENTICATE = "SELECT * from employeenumbers where numbers "
Rs.Open AUTHENTICATE, schedule, 1,3
 
if u want to see if an number is in database use this
and the Request("numbers") is the value submited by the first form, we use Request("numbers") cuz it call both metods to extract the value,Request.QuerryString then Request.Form

Code:
AUTHENTICATE = "SELECT * from employeenumbers where numbers="&Request("numbers")
Rs.Open AUTHENTICATE, schedule, 1,3
if Rs.RecordCount=0 then
'we have no number in database
end if

________
George, M
 
Thanks, is there something I also need to do with RecordCount?
this is what I have so far...

dim AUTHENTICATE
AUTHENTICATE = "SELECT * from employeenumbers where numbers " & Request("numbers")
Rs.Open AUTHENTICATE, schedule, 1,3
if Rs.RecordCount=0 then
'no employee numbers matched.
response.redirect "numauth.asp"
end if
 
I got it, thanks for the help, here is what I eventually ended up with.

<%
dim AUTHENTICATE
AUTHENTICATE = &quot;SELECT * from employeenumbers where numbers&quot;
Rs.Open AUTHENTICATE, schedule, 1,3
recordcount = 0
do until rs.eof
if request.form(&quot;numbers&quot;) = rs(&quot;numbers&quot;) then
recordcount = recordcount + 1
end if
rs.movenext
loop
set Rs = nothing
set schedule = nothing
if recordcount = 0 then
response.redirect &quot;numauth.asp&quot;
end if
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top