Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Checking to see if someone has voted
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Checking to see if someone has voted

 Post Reply Post Reply
Author
choshour View Drop Down
Newbie
Newbie
Avatar

Joined: 24 February 2003
Location: United States
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote choshour Quote  Post ReplyReply Direct Link To This Post Topic: Checking to see if someone has voted
    Posted: 30 June 2003 at 9:05am

<!--#include file="..\forum/common.asp" -->
<!--#include file="check_permission.asp" -->

<%

'Dimension variables
Dim Conn    'Holds the Database Connection Object
'Dim strSQL   'Holds the SQL query for the database


'Create an ADO connection odject
Set Conn = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("?????.mdb")
%>
<!--#include file="check_voted.asp" -->

 

Here is the include file:

<%
Dim rsVoted
Dim SQL

set rsVoted = Server.CreateObject("ADODB.Connection")

SQL= "SELECT COUNT(*) FROM ratings WHERE UserName='" & strLoggedInUsername & "'"

rsVoted.Open SQL, conn

IF rsVoted.Fields(0).Value <> 0 then
Response.Redirect "
http://www.p-15.com/team_ratings/voted.asp"
END IF

rsVoted.close
set rsVoted = nothing
%>

I get this error

Microsoft OLE DB Provider for ODBC Drivers error '80040e4e'

Operation was canceled.

/Team_Ratings/check_voted.asp, line 9

 

Any ideas I am trying to check and see if this user had vote in the poll already.  We you vote I store the username with it.  I want to check and see if the username is in the database.  If so then redirect them to another page.

Hope someone can help me.

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2003 at 11:19am

<%
Dim rsVoted
Dim SQL

set rsVoted = Server.CreateObject("ADODB.RecordSet")

SQL= "SELECT COUNT(*) FROM ratings WHERE UserName='" & strLoggedInUsername & "'"

rsVoted.Open SQL, conn

IF rsVoted.Fields(0).Value <> 0 then
Response.Redirect "
http://www.p-15.com/team_ratings/voted.asp"
END IF

rsVoted.close
set rsVoted = nothing
%>

Contribute to the working anarchy we fondly call the Internet
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2003 at 12:06pm

nice spot morningz! I missed that one

Back to Top
choshour View Drop Down
Newbie
Newbie
Avatar

Joined: 24 February 2003
Location: United States
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote choshour Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2003 at 2:40pm
Thanks a lot that explains it.  I ended up going back and starting the code for that page over and got it working.  I still did not know what was different.  Now that you pointed it out it obvious.  Thanks again.  This makes code so much easier when you have more than one set of eyes looking at a problem
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.