|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Do While Not rs.EOF easy for you guys
I would never usually ask but im sooo stumped you would not belive!!!
im trying to run a vote with a 24 hour time limit/ date between voting. (ive done it with cookies in the past but people have just started clearing their cookies) the idea is the page reads the ip address from the url: /inc_voting.asp?IPDATE=24%2F10%2F2005&IPCHECK=***.**.**.** then checks to see if the IP address is currently in the DB (if not it will allow you to vote). if it finds your ip in the DB it then checks to see if the dates match (if it does match it sends you to you cant vote page) if the dates dont match then it allows you to vote again. Code:
<%
Session.LCID = 2057
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open MM_connDUpoll_STRING
Query = "Select * from tbl_check WHERE IPCHECK='"&Request("IPCHECK")&"'"
Set rs=Connect.Execute(Query)
If rs.EOF then
Response.Redirect("YOU CAN VOTE PAGE")
Else
Do While Not rs.EOF
If FormatDateTime(Request("IPDATE"))=FormatDateTime(rs("IPDATE")) then
Response.Redirect("SORRY YOU CANT VOTE PAGE")
Else
Response.Redirect("YOU CAN VOTE PAGE")
End If
rs.MoveNext
Loop
End If
rs.Close
Connect.Close
%>
the problem is its only reading the first ip address and not reading all the way through checking each ip entry against the date. i cant see what ive done wrong and any help would be greatly appreciated. Regards Charlie |
|
#2
|
||||
|
||||
|
try this..
Code:
<%
Session.LCID = 2057
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open MM_connDUpoll_STRING
Query = "Select * from tbl_check WHERE IPCHECK='"&Request("IPCHECK")&"'"
Set rs=Connect.Execute(Query)
If rs.EOF then
Response.write("YOU CAN VOTE PAGE")
Else
Do While Not rs.EOF
If FormatDateTime(Request("IPDATE"))=FormatDateTime(rs("IPDATE")) then
Response.write("SORRY YOU CANT VOTE PAGE")
Else
Response.write("YOU CAN VOTE PAGE")
End If
rs.MoveNext
Loop
End If
rs.Close
Connect.Close
%>
__________________
Nothing is Impossible bcoz IMPOSSIBLE itself says.. I M POSSIBLE........................ Be cool !!!!!!!!
|
|
#3
|
|||
|
|||
|
Howdy, thanks for the quick response,
unfortunately it only works if the current date is the first ip result found, if the viewer has voted before then it stops reading the ip address and just lets them vote instead of reading through all the viewers ip address's and checking the date on them all. the code im using to test is: Code:
<%
Session.LCID = 2057
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open MM_connDUpoll_STRING
Query = "Select * from tbl_check WHERE IPCHECK='"&Request("IPCHECK")&"'"
Set rs=Connect.Execute(Query)
If rs.EOF then
Response.redirect("http://www.msn.co.uk")
Else
Do While Not rs.EOF
If FormatDateTime(Request("IPDATE"))=FormatDateTime(rs("IPDATE")) then
Response.redirect("http://www.google.co.uk")
Else
Response.redirect("http://www.msn.co.uk")
End If
rs.MoveNext
Loop
End If
rs.Close
Connect.Close
%>
Ta Charlie |
|
#4
|
||||
|
||||
|
try this.
Code:
<%
Session.LCID = 2057
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open MM_connDUpoll_STRING
Query = "Select * from tbl_check WHERE IPCHECK='"&Request("IPCHECK")&"' and ipdate=#"&request(ipdate)&"#"
Set rs=Connect.Execute(Query)
If rs.EOF then
Response.redirect("http://www.msn.co.uk")
Else
Response.redirect("http://www.google.co.uk")
End If
rs.Close
Connect.Close
%>
|
|
#5
|
|||
|
|||
|
didnt like that at all im afraid ...
dont think its partial to the if sorry to be bugging you with this one Charlie |
|
#6
|
||||
|
||||
|
Quote:
Use your original code and try the modification: Code:
<%
Session.LCID = 2057
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open MM_connDUpoll_STRING
Query = "Select * from tbl_check WHERE IPCHECK='"&Request("IPCHECK")&"'"
Set rs=Connect.Execute(Query)
If rs.EOF then
Response.Redirect("YOU CAN VOTE PAGE")
Else
Do While Not rs.EOF
If FormatDateTime(Request("IPDATE"))=FormatDateTime(rs("IPDATE")) then
canVote = "No"
End If
rs.MoveNext
Loop
End If
rs.Close
Connect.Close
If canVote = "No" then
Response.Redirect("SORRY YOU CANT VOTE PAGE")
Else
Response.Redirect("YOU CAN VOTE PAGE")
End If
%>
Because you were redirecting upon reading of the first record, it never did perform a full loop through all the records.
__________________
Come JOIN the party!!! Quote of the Month: Retirement: Because you've given so much of yourself to the company that you don't have anything left we can use. Questions to Ponder: What do you do when you see an endangered animal eating an endangered plant? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#7
|
|||
|
|||
|
Ta very much
![]() |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Do While Not rs.EOF easy for you guys |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|