Create dynamic web pages with Microsoft Access

Content
  1. Open the database
  2. Open the item you want to post
  3. Start the export process
  4. Create file name
  5. Save file
  6. Open the ODBC Data Source Control Panel
  7. Add a new data source
  8. Choose a driver
  9. Set up a data source
  10. Select database

Open the database

In our last tutorial, we went through the process of creating a static web page from data stored in an Access database. This simple method of publishing web pages was suitable for environments where we wanted a “snapshot” of the database, such as a monthly report, or where the data rarely changes. However, in many database environments, data changes regularly and we need to provide Internet users with up-to-date information with a single click.

We can meet these requirements by using Microsoft’s Active Server Pages (ASP) technology to create a dynamically server-generated HTML page that links to our database. When a user requests information from an ASP page, the web server reads the instructions in the ASP, accesses the underlying database accordingly, and then creates an HTML page containing the requested information and sends it back to the user.

A limitation of dynamic web pages is that they cannot be used to distribute reports, as we did in our tutorial on static web pages. They can only be used to display tables, queries, and forms. In this example, let’s create a real product catalog for our Internet users. For our example, we will again use the sample database Northwind and Microsoft Access 2000.

Open the item you want to post

When you see the main database menu, select the submenu tables . Double click on an item Products in the table.

Start the export process

Open the menu File and select Export options .

Create file name

At this point you will need to provide a name for your file. We will name our products. You should also use a file browser to find the path to publish your file. This depends on your web server. The default path for IIS is − intpubwwwroot . After completing this step, click the button save everything .

In the Microsoft ASP Output Options dialog box, you can specify the details of your ASP. First, you can choose a template for formatting. Some sample templates are stored in the folder Program FilesMicrosoft OfficeTemplates1033 . In this example we use Simple layout.htm .

The next item is the name of the data source. It is important to remember the value you enter here – it specifies the connection the server uses to access the database. You can use any name here; we will establish a connection in a few minutes. Let’s call our data source north wind .

In the last section of our dialog we can specify the URL and timeout values ​​for ASP. URL is a method to access our ASP over the internet. Here you must enter a value that corresponds to the file name and path selected in step 5. If you placed the file in the wwwroot directory, the value of the URL http://yourhost.com/Products.asp where your host is the name of your machine (ie database.lifewire.com or www.foo.com ). The timeout value allows you to specify how long the connection remains open for an inactive user. Five minutes is a good starting point.

Save file

Press the button Okay and your ASP file will be saved to the path you specified. If you now try to open the page, you will get an ODBC error. This is because we have yet to determine the data source and the web server cannot find the database.

Open the ODBC Data Source Control Panel

The process for doing this differs slightly depending on your operating system. For all operating systems, click Get started , Settings and then Control panel . If you are using Windows 95 or 98, double click the icon ODBC (32-bit version) . For Windows NT, select the icon ODBC . If you are using Windows 2000, double click Administration and then double click Data Sources (ODBC) .

Add a new data source

First click on the tab System DSN at the top of the Control Panel dialog box. Then press the button To add to start setting up a new data source.

Choose a driver

Select the appropriate Microsoft Access driver for your language, then click Finished Get on.

Set up a data source

In the dialog box that appears, enter a data source name. It is imperative that you enter it exactly as you did in step 6. Otherwise, the link may not work correctly. You can also enter a description for the data source here for future reference.

Select database

Press the button Select and then use the file navigation pane to locate the database file you want to open. If you installed it with the default installation, the path should be: Program FilesMicrosoft OfficeSamplesNorthwind.mdb . Press the button Okay in the navigation pane, then click the Okay in the ODBC settings window. Finally click on the button Okay in the Data Source Manager window.

Please use your browser to make sure your Active Server page is working properly. You should see something similar to the screenshot above.

Leave a Reply

Your email address will not be published.