Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Where to Start - Page 2

January 8, 2001

The first thing to do is figure out where to start. For our purposes in this article, which is to learn about coding in a practical context, let's just assume that you have a page design complete and you want your poll to be in a simple HTML table. With that in mind, I am going to try to ignore HTML as much as possible so we can focus primarily on the guts of the system - the ASP code.

The next step is to design a database for your polls. I am going to use Access 2000 to accomplish this task. The database is called polldb.mdb and it has two tables: tbl_questions and tbl_responses. These tables are related with a one-to-many relationship where tbl_responses contains the foreign key reference to the primary key of the tbl_questions table. Just to be certain everyone is on the same page, here is a translation of what I just said.

The tbl_responses table contains responses for the various poll questions. Each poll question can have zero or many responses. That means for each record in tbl_questions there will be zero or many corresponding records in the tbl_responses table. To make this possible, the two tables must be related - which means exactly what it sounds like it means. Practically speaking, there must be a column in the tbl_responses table that stores the value of the primary key (technically a candidate key but let's not go there) of the tbl_questions that the responses belong to. See below for an illustrated explanation.

Relationship Now, in order to save a little time, I have setup both tables myself and am providing a screenshot of their design in the screenshot below:

Poll Tables

Finalizing the Database

Once you have your database designed, you need to populate the tables with an initial question and options so you can later see the fruits of you labor. Come up with a generic question for the first record in the tbl_questions table and then add a few options in the tbl_responses table (make sure for each option you store the PollID of the tbl_questions in the PollID field of the tbl_responses table - otherwise you will not have a relationship between the two and nothing will work later on).

Once you are satisfied with your first question and its options, the next step is to make your database Web-ready. For us, that means registering a DSN for the database with the operating system (we are, or course, assuming Windows 9x, ME or NT/2000). If you do not know how to do this, I explained how, step-by-step, in another article, so take a timeout from this article and check it out. When you are ready to actually set up your DSN entry for this example system, call it polldb (you can name it anything you like, just be advised that I will refer to it as polldb throughout all the code examples).

Poll Your Visitors with ASP
Poll Your Visitors with ASP
The Birth of a Poll - Page 3


Up to => Home / Authoring / ASP / Polls




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers