Click here to Skip to main content
15,909,437 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi everyone...

I am currently bizy with online voting system and i want the vote to be for a specific dates...
if the vote date is not yet reach, the voter should not able to vote, when they try to click the button vote it should let them know that the date is not yet reach...

PROBLEM


1. How do i search such code on google
2. How do i write the store procedure

if you have a reference link you are welcome to give it to me
i will appriciate your help
Posted
Comments

1 solution

This is how I understand your questions, let say you have an existing table name tblVotes
and you already have data of voters with the ff. fields

VotingDate - the actual voting date which you said the system will only accept
IsVoteAccepted - boolean field indicating if the vote is accepted

//variable
VotedDate - this is when the user cast their votes

Sp might look like this

SQL
USE Votes
GO
CREATE PROCEDURE usp_Votes
    @VoteDate Date
AS 

     UPDATE tblvotes
     SET    IsVoteAccepted = 1
     WHERE  VotingDate <= @VoteDate
GO
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900