Make a Database

The database will hold all the information we can use to send out the newsletter. We'll need to identify all the fields we want in the database, so we can design it accordingly. Here are the fields we want to put into this database:

Information

Field Name

Field Type

Field Length

First Name

FirstName

Text

255

Last Name

LastName

Text

255

Street Address

Address

Text

255

City

City

Text

255

State

State

Text

255

Zip Code

Zip

Text

255

Country

Country

Text

255

E-mail Address

Email

Text

255

That should about do it. The next step is to create the database. Since the database will need to have write access for the anonymous user, we will need to add that to the NTFS permissions. Because of this, it's a good idea to store the database in a directory that's different from the directory the web site is stored in. When it's in the same directory as the web site, it's too easy to modify the permissions so that no one can write to the database-or even worse, so that the permissions on the entire directory are open. When Microsoft Access opens a file, it creates a .LDB file, which is a lock file. Unless the anonymous user has the ability to create and destroy files in the directory that holds the database, you'll experience issues.

Let's create a directory on our E: drive, as we did earlier for the web site, and call it 'Databases.' Make sure the Anonymous access group has modify rights to this directory.

To create the database, you can use either the GUI (graphical user interface) in Microsoft Access or a SQL statement. Let's call the database BeerBrewersDB.mdb, and the table in that database can be called BeerBrewersTable. The GUI is pretty much self- explanatory, so here's the SQL statement that's used to create this table:

create table BeerBrewersTable  ( FirstName varchar(255),  LastName varchar(255),  Address varchar(255),  City varchar(255),  State varchar(255),  Zip varchar(255),  Country varchar(255),  Email varchar(255) ) 

Now that the database is created, we need to create the DSN for the database.

  1. Choose Start | Administrative Tools | Data Sources (ODBC).

  2. In the Data Sources Administrator, choose the System DSN tab.

  3. Click the Add button to add a new data source.

  4. The Create New Data Source screen will appear. Choose Microsoft Access Driver (*.mdb).

  5. Click Finish.

  6. Type in the data source name: BeerBrewersDSN.

  7. Click Select and browse to the Access database you created earlier (E:\Databases\BeerBrewersDB.mdb).

  8. Once you've selected the Access database, click OK until you close the ODBC Administrator.

Now perform these same actions for a test database for the test site. If you like, you can create another table in the BeerBrewersDB.mdb. That way, you don't have to create a directory or make a new DSN, and you can just insert a new table with the same specs.

Tip 

If you use Microsoft Access to make the table, you may want to make sure that the fields are all set to 'Allow Zero Length = Yes'. The default is No, but this setting will cause an error if all the fields are not filled out.




IIS 6(c) The Complete Reference
IIS 6: The Complete Reference
ISBN: 0072224959
EAN: 2147483647
Year: 2005
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net