Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 24th, 2005, 07:12 AM
charlie_davey_u charlie_davey_u is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 4 charlie_davey_u User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 57 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old October 24th, 2005, 07:23 AM
Guddu's Avatar
Guddu Guddu is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2005
Location: Oxford UK
Posts: 3,685 Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 2 Days 22 h 38 m 43 sec
Reputation Power: 798
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 !!!!!!!!

Reply With Quote
  #3  
Old October 24th, 2005, 07:39 AM
charlie_davey_u charlie_davey_u is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 4 charlie_davey_u User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 57 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old October 24th, 2005, 07:48 AM
Guddu's Avatar
Guddu Guddu is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2005
Location: Oxford UK
Posts: 3,685 Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level)Guddu User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 2 Days 22 h 38 m 43 sec
Reputation Power: 798
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
%>

Reply With Quote
  #5  
Old October 24th, 2005, 08:12 AM
charlie_davey_u charlie_davey_u is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 4 charlie_davey_u User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 57 sec
Reputation Power: 0
didnt like that at all im afraid ...

dont think its partial to the if

sorry to be bugging you with this one

Charlie

Reply With Quote
  #6  
Old October 24th, 2005, 01:06 PM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
ASP Free God 16th Plane (12500 - 12999 posts)
 
Join Date: Feb 2005
Location: Dreamland
Posts: 12,867 mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 4 Months 4 Weeks 15 h 21 m 57 sec
Reputation Power: 1762
Quote:
Originally Posted by charlie_davey_u
didnt like that at all im afraid ...

dont think its partial to the if

sorry to be bugging you with this one

Charlie


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

Reply With Quote
  #7  
Old October 25th, 2005, 04:29 AM
charlie_davey_u charlie_davey_u is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 4 charlie_davey_u User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 57 sec
Reputation Power: 0
Ta very much

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Do While Not rs.EOF easy for you guys


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT