When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Senior Developer (.NET)
Professional Technical Resources
US-CA-Santa Cruz

Justtechjobs.com Post A Job | Post A Resume

Published: Saturday, July 10, 1999

Creating User Polls


It seems like every site has a poll on their start page these days, especially the big media sites, such as ABCNEWS.com and MSNBC.com, just to name a couple. Well, I've got news for you: it's time to conform. So, let's look at how we can add professional looking user polls to our ASP websites.

- continued -

We'll need two tables in a database to accomplish this. The first table is called Poll, and contains information on all of our Polls. The really isn't much information that it needs to store, just the Poll question and the run dates for the poll. Let's look at the structure for this table:

Poll
PollIDAutonumber
PollQuestionText (150)
DateStartDate/Time
DateEndDate/Time

DateStart and DateEnd are used to determine the running times of your polls. This way, you can create many polls, with some scheduled for the future. Also, you can bring back old polls, or easily show the results of older polls.

The second table will hold the questions for each of our polls, and will aptly be named PollOption:

PollOption
PollOptionIDAutonumber
PollIDNumber
QuestionTextText (100)
VotesNumber

PollOption.PollID is a Foreign Key to Poll.PollID. It represents what poll this question belongs to. So, let's say we want to have a poll that asks, "Have you programmed Cold Fusion webpages before?" and runs from 7/13/99 to 7/20/99. We want to give the users two options to select, "Yes" and "No." Here's the steps we'd need to do:

    1.) Insert a row into Poll, setting PollQuestion to "Have you programmed Cold Fusion webpages before?", DateStart to 7/13/99 and DateEnd to 7/20/99.
    2.) Insert two rows into PollOption. Both rows would have Votes initially set to zero and PollOption.PollID set to the the Poll.PollID that was assigned in Step 1. For the first row, set QuestionText to Yes, and for the second row, set QuestionText to No.

That's it! It's that easy! Now, all we need to do is add some ASP code to the page that we want to display the poll/poll results. If you haven't already seen ABCNEWS.com's poll, I'd suggest checking it out; it has the UI I'm going after with my approach.

Once you're ready, let's move onto Step 2, where we'll look at the ASP code needed to make our polling system a reality!

  • Proceed to Step 2


    Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article

  • internet.comearthweb.comDevx.commediabistro.comGraphics.com

    Search:

    Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

    Jupitermedia Corporate Info

    Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
    Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers