Connecting to a database via ASP

The ASP Connection

The next time you create a website think about how you want to get information to others. Is it information that is going to change or stay the same? If it's going to stay the same then you create your html document and you're done with it. However, if you want to change that information at a later date you have to update the document each time you have new information to add. Depending on how often you update this task can become a time consuming choir. There's a better way out there to serve up fresh web pages daily or even by the minute. We are going to explore the benefits of ASP (Active Server Page) technology and how to use it to connect to a database via your web page.

Getting Your ASP On

Example of an ASP tag

<% Response. Write "I'm an ASP Tag!" %>

ASP or Active Server Pages is a technology created by Microsoft back in the mid 90's. In non-technical terms it allows the web page to talk to the database and return results back to the web page via the server. ASP effectively allows you to create dynamic web pages rather than boring static pages.

The first thing you need to do is create an Access or SQL database to hold your information. I typically use Access first to design my tables that store the data. It's wise to map out your database design before you start storing data in it. That way it's not difficult to make changes to the structure of your database at a later time. In this example we'll create a very simple database that will secure your information by asking users to login in for access and create a table that will store and display links to favorite websites.

Setting Up Your Database Using Microsoft Access


You need to have Microsoft Access to create a table needed store login access information. Open Access, select new blank database, save your new database to your PC and then click on the icon to create a new table with the columns needed to store your login data. I would suggest columns named "username", "password", "FirstName", "LastName" and information you would like to gather at login. I usually add information that will carry from one page to the next to customize form features. Now when "Joe Smith" logs in the information is sent to the server to match against the database. If it is incorrect then a message is displayed letting the user know they need to re-enter the information into the form. If correct then they are sent to the next page on the site where you might fill out a form or other information might be displayed. The information that you store in the login table can determine how information is displayed to the user. An example would be that "Joe Smith" is from Idaho; stored with his information is a column called "State" with "ID" stored as the state he resides in. When Joe logs into your website you can create a session which stays with him while logged into your site. This allows you to create smart forms that can be customized depending on your needs. Now you can have the form display information such as the cities for Idaho because you know this person is located in that state. You could also do this such as displaying the page in a larger font by creating a table of user preferences.

Information on how to create tables using Microsoft Access can be found on the Microsoft website:
Click Here

Next time I'll talk about hosting your database and explain how to make the connection between your database and your pages.

Effective Web Design 101

Web Design 101

Your Virtual Storefront


I've been creating website since the days of NetScape 1.0 came out. I thought I'd share some of my tips regarding effective website creation and design. I come across poor website design all the time when surfing the net. When you first create a website you should think about layout and how others will navigate your site. Do your research and find out what others are doing before you just toss together a site. Think of a website like a storefront in your local mall. Your home page is much like a storefront because it's the first thing your visitor sees. If its eye catching and always up-to-date then visitors will stay and view your site. If you walk by a store with a bad window display or the same as your last visit, what are the chances you are going to check things out? So you can see the importance of designing a great home page.

Keep it Clean

Don't overwhelm someone with a lot of information on your home page. I recommend a mix of 70/30 depending on the type of site. Give your users about 70 percent content mixed with 30 percent graphics/images/ads to compliment your content. Keep your visitors engaged in your content to keep them coming back. Ever had a hard time finding your keys in a cluttered room?

Easy Navigation

One of my favorite sites is DynamicDrive.com which offers lots of free cool stuff. Stuff that helps you make your website stand out from others in the crowd. I mainly use the navigation tools they provide on my websites. Both SpreadViralVideo.com and MyVolunteer.com use navigation that I found on DynamicDrive.com. I've also used code that disables the "Submit" button after its been clicked. That way the user cannot click it a 2nd time, preventing duplicate information.

Research Other Sites

While you want your creativity to be your own it's a great idea to see what others are doing. I often check out the design of other websites to see what others are doing. I did this years ago when I first started creating web pages to learn the art of HTML. When I started I didn't have the luxury of books or even classes on how to code HTML, JavaScript and other coding languages of the web.

Tools of the Trade

I want to finish up with just briefly talking about some of the tools of the trade. I have hard coded websites in the past however I mostly use WYSIWYG(What You See Is What You Get) software when developing my current websites. I don't know about you but I don't have a lot of free time, so I use FrontPage from Microsoft. I'm not part of a website team so I'm on my own when it comes to developing my websites. Therefore I use software that lets me crank out pages and a fast pace. Besides FrontPage other editors on the market are Dreamweaver, Microsoft Expression Web(replaces FrontPage) and Adobe® Contribute® CS3 to name a few. Most of these allow you to use a simple "Compose" mode to create your web pages. These editors make it easy for you to add images, navigation, links, create tables and other aspects of a web pages quickly. Those who know how to code can switch to the HTML mode to have more control of the design.

If you're interested in purchasing any of the popular HTML editors I've listed a few below.

Expression Web


Expression Web (Full Product, PC)


Expression Web (Full Product, PC)

FrontPage

FrontPage 2003 (Full Product, PC)


FrontPage 2003 (Full Product, PC)

Dreamweaver

Adobe Dreamweaver CS3 - Complete Product - 1 UserPC


Adobe Dreamweaver CS3 - Complete Product - Complete Product - 1 UserPC

More applications can be found on CNet's site Download.com and are either free or try and buy trials. Most of the above software can usually be downloaded and tried out for 30 days before you buy. Give them a spin and see what types of creations you can come up with.

Do you have any tips to share with others? Have a favorite HTML editor? Feel free to comment below.

Web Guy Guru Recommends: