Article | Topic: ASP Database Connectivity

Online Portfolio | Search Optimization | Archive
Web Design | Custom Scripting | Web Database | E-Commerce | Search Optimization | Flash Web Design | Consulting
Template 'Tuning' | Template Designs
Desktop Solutions | Database Solutions | Automation Solutions | Integration | Project Solutions
Flash | 3D Design | 3D For The Web | Animation | Graphic Design | Conceptual Design | Reality Modeling
E-Learning | Disc Media | Business Graphics | Marketing Media | Custom Documents
Articles | Price Quotes | Site Map | Search Site | Web Links | About Neo•Paradigms | Contact Us
Anatomy of a Dynamic Web Page

Part 2: Online Data Access

Update Your Online Database
Recall that we are still processing from a single page. Immediately following your validation code is the best place to locate your database connection and record insertion code.

Although we have taken care not to allow incomplete information (and while not part of this article, you should also have checked for malicious code entered as text) there is another task required to ensure good data and, along the way, prevent data entry errors as well:

Check For Duplicate Data Entry Before attempting to add a new record!

Any good database design will include some measure of indexing and referential integrity. If these are Greek words to you, don't worry. The upshot is that database development and ASP database connectivity coding should not permit or force duplicate information in your database. It's all well and good that you may have thrown together a quick Access database with all default values (thus ensuring the fewest end user errors but not necessarily the most astute design) but we will take steps now to code around any flaws inherent in the database itself - if they exist.

For instructional purposes, we will assume that you have required four inputs; First name, Last Name, Company, and Phone Number. We will also assume that you have preformatted the phone number to a consistent format at the validation stage (not a bad idea - hint, hint!). These four string values, by our rules, must be unique to permit a new data record. You should code for record updates versus inserts based upon same name but new company or new phone (I would count same name and differing company and phone as a new entry) but we will skip that here.

The pseudo code for this would look something like:

    declare dbConnect variable
    declare dbRecordset variable
        Open connection
        Open recordset containing FirstName,LastName,Company,Phone values

        Check if all four values fit the first record
            If YES, set a flag to stop checking
        If no flag is set, check the next record (until done)

        If Flag is set
            Do Nothing - no need, record exists
        Otherwise
            Close recordset and reopen with all datafields
            Add user input to new record

        Close recordset and data connection.

That takes care of our online database work! Not too intense at all was it? All that remains now is to finish our task by sending ourselves the message by email...

Anatomy of a Dynamic Web Page Part 3: Send Email

                       About Us | Site Map | Privacy Policy | Contact Us | ©1992 - 2005 Neo•Paradigms