Lesson 17: Databases

There are many different databases: MS Access, MS SQL Server, Oracle SQL Server, MySQL and many others. In this tutorial, we will use the Microsoft Access database. Access is the natural place to start when you want to use databases in ASP.

In this lesson, we will start by looking at the Access database that we will use in the next lessons. Access is part of the Microsoft Office family and is included in some of the Office suites. You need to have Microsoft Access installed on your computer in order to go through this lesson and the next lessons. A trial version can be downloaded at http://office.microsoft.com.

Below you can download the database used in the examples in this tutorial. In the examples, Access 2010 is used but there are no significant differences in the screens that appear.

Download: Download the database

About Microsoft Access

Once you've downloaded and opened the database, you will see a screen with a list of the tables in the database. We will only use one table in the database. The table is named "people" and contains names and birth dates.

Listing of tables in Access database

You open the table by double clicking on it. There are many different ways you can work with tables in Access. We will not go into depth with Access as a tool, but only look at the very basics you need to know to use Access as a database for your ASP applications.

The table opens by default in Datasheet View. If you are used to working with spreadsheets, or maybe has used Access before, the table view will look familiar to you with columns and rows:

Datasheet

As you can see, in the table, we have listed some of the residents from Duckburg.

There are primarily two different ways of viewing a table in Access: Design View and Datasheet View. Above, you see the table in Datasheet view, meaning that you see the table with all the values. In the upper left corner of the program you can switch between the two view types:

Menu to switch between the two views

The Design View gives you an overview of the columns and the data types. In a database, it does matter what type of content there is in a column. In our database, three different data types are used: text, number and date. There are many different options in the Design View. See the help feature in Access for more information.

Design View

This was a short introduction to Microsoft Access. In the beginning, you don't need to change anything in the database and can use it as is. Later, you can create your own databases, which is actually easy and straightforward.

In the next lesson, we will look at where to place the database and how to create a database connection.



<< Lesson 16: Writing to a text file

Lesson 18: Database Connections >>

cron