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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP back-end for online election

Status
Not open for further replies.

jasonsalas

IS-IT--Management
Jun 20, 2001
480
GU
Here's what I'm trying to do: I'm running an online election service, so candidates under a senatorial race appear on a ballot, but logically, can be voted for (or not), using checkboxes. My problem in processing the info.

To display this in ASP, I need a single field populated in my DB to call from my derived recordset. I first tried using boolean values, but the resultant recordset then has a different field name per candidate (of which there are a lot), and it doesn't come out with values all under a single field, which I can't displaying in ASP.

I'd optimally like the DB table to have the following:
tblElection
- fieldID (autoID)
- fieldName (text)
- fieldPartyAffiliation (text)
- fieldVotes (number)

The main problem is getting all of those candidates with their respective vote totals all under one unified field name. I was thinking I might have to loop to SQL insert statement to go over the ballot and insert a "checked" value, and then in a DB query for presentation sum up all of the votes. But that's where I'm stuck.

I've racked my brain trying to figure this one out...any suggestions on the DB design?

Thanks! :)
 
[tt]I personally don't understand the problem...
... but let me try to see if I understand it.

Say I vote for candidate 1 and so have other 50 people. You want to display all information related to a particular candidate in one field?

So, your display would be as follows:

Candidate #1 Number of Votes PartyAffiliation
John Smith 51 None
etc etc etc
[/tt]

"The reward of one duty done is the power to fulfill another"
J R C L [jester] W N


 
[tt]I meant
Candidate #1 Number of Votes PartyAffiliation
John Smith 51 None
etc etc etc

[/tt]

"The reward of one duty done is the power to fulfill another"
J R C L [jester] W N


 
Thanks for the feedback. Essentially, I'm looking for a way to design the DB so that all of the candidates can be easily displayed in ASP 3.0. Each candidate on a previous Web form will be entered via a checkbox...which I can then enter into the DB as a text value, or boolean.

My problem is that for every candidate that was checked-off, I need to write a value to the DB. For design efficiency, this would mean I would need to have a single record hold one field per candidate, each storing the vote/not vote value:

tableElection
- fieldCandidate1
- fieldCandidate2
- fieldCandidate3
- .......
- fieldCandidateN

This prevents me from using ASP to display the results of the voting in order of who got the most votes, because there's no consistent field, as everyone has got their own. It prevents ordering of the data, in other words. What I'd like to have would be:

tblElection
- fieldID (autoID)
- fieldName (text)
- fieldPartyAffiliation (text)
- fieldVotes (number)

...but I can't figure out how to create the DB table, insert the data into it, and pull it out in an efficienct manner such that all votes will be in the "fieldVotes" field.

Thanks again! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top