ColdFusion 4.0 Primer

Basic Database Setup

When creating your database there are some things you should know. First of all never include a space in your field names. This will cause problems later. Second never name a field name using a reserved keyword such as 'text' or 'date' this will also cause problems. Finally you must correctly specify the field datatype. What follows is a list of datatypes and what is commonly used to input into them.

Table 2. Datatypes
DataTypeDetailsAssoc. HTML Form Types
Text255 Character Limit Radio, Select, Text, Password
NumberNumber Only Radio, Select, Text, Password
Date/TimeDate or Time(mm/dd/yy)Radio, Select, Text
Yes/NoTrue or False Value Checkbox
AutoNumberAutomatically Numbers RowsNone
CurrencyFormats for Currency Radio, Select, Text
MemoText without limitTextarea

There are some notes on the above table. First of all The autonumber datatype is perfect for numbering articles. Everytime a new article is added it will simply generate an ID for it which can be used for a variety of purposes since each article will have a unique ID. The second note is that the memo datatype does have a limit, however it is so large you will likely never reach it.

ColdFusion Database Integration

Now that you know the basics of what you need to create a database integrated website it is time to put everything together.

Create a Database named Friends, and a table within it named Friends. Create the following Fields and Datatypes:

FirstName - Text
LastName - Text
Age - Number
FriendID - AutoNumber
Sex - Text
FavMovie - Text
FavColor - Text
Car - Text
Comments - Memo

Then fill in the appropriate values for a number of people. Upload it to your server and tell your Server Admin to create a DSN named "Friends" for it using Microsoft Access Drivers.