This project creates a virtual bookstore using Microsoft Active Server Pages (ASP) technology. You will construct several pages that advertise books and take orders. The primary component of the project is the Connection component, which uses ActiveX Data Objects (ADO) to access ODBC data sources.
Completing this exercise depends on the correct setup of the
Microsoft Agent control. Although Internet Explorer 4.0 ships with
the final version of the Agent control, this exercise was created
with the beta 3 version of the control. This means that you should
not install the Agent control that ships with IE 4.0, but rather
install the beta 3 version from the CD-ROM that
As an alternative, you can examine the documentation for the IE 4.0 Agent control and determine whether the code in this exercise is acceptable. You might also choose to modify some of the code where appropriate.
To begin a new Web project, start Visual InterDev and choose New
from the File menu. When the New dialog box appears (Figure 6-1),
click the Projects tab and choose the Web Project wizard. Then
specify a location for your project files in the Location box, give
your project the
Figure 6-1. The New dialog box.
The Web Project wizard (Figure 6-2) will ask you for the name of the Web server on which the new project will be created. If this text box contains an entry, you can accept it; if the box is empty, type the name of the machine that is running Internet Information Server (or Personal Web Server). (If you don't know the correct name of your Web server, look up the Identification information by using the Network applet in the Control Panel.) Click Next.
The Web Project wizard will contact the selected Web server and present you with the step 2 dialog box. Choose the option Create A New Web. Make sure the name of the web is Bookstore. Check the option to enable full-text searching of the site, and click Finish.
Figure 6-2. The Web Project wizard.
Key PointIn Visual InterDev parlance, a web refers to a set of Web pages that are actually under the control of Internet Information Server. A project, on the other hand, is a set of files created and
maintained by Visual InterDev.
The Web Project wizard will create your new web and
When the Web Project wizard creates your web, several elements are provided by default. You can examine these files by clicking the FileView tab, which lists files named GLOBAL.ASA and SEARCH.HTM and a directory named IMAGES. These filenames might appear gray because they exist on the Web server but not in your working directory. Select the files in the FileView tab, and then choose Web Project/Get Working Copy from the Project menu to update your working files.
Double-click GLOBAL.ASA. This is a special file that Visual
InterDev uses to track the beginning and end of
Right-click SEARCH.HTM. Choose Preview In Browser from the pop-up menu. Visual InterDev shows you the Internet Explorer search form, which is used to perform full-text searches of your Web site.
{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %}Close the open files by choosing Close All from the Window menu.
This project utilizes a Microsoft Access database named BIBLIO.MDB to provide the online database of books, publishers, and authors. This database ships with many Microsoft development tools, including Visual Basic. In order to access this database, you must establish an ODBC data source on your machine.
Minimize Visual InterDev. You will now be working with the ODBC Data Source Administrator to create your new data source. Open the Control Panel by choosing Settings/Control Panel from the Start menu. In the Control Panel, locate the icon labeled ODBC. Double-click this icon to open the ODBC Data Source Administrator (Figure 6-3).
Figure 6-3. The ODBC Data Source Administrator.
The ODBC Data Source Administrator converts existing databases to ODBC data sources. Data sources that you create for use with Visual InterDev should be System DSN or File DSN sources. Click the System DSN tab, and click the Add button.
In the Create New Data Source dialog box, select Microsoft Access Driver and click Finish. The ODBC Data Source Administrator will display the setup dialog box for Access data sources.
In the Data Source Name text box, type WebPages for the data source. This is the ODBC alias you will use to access the database. Click the Select button, and navigate to the file BIBLIO.MDB. (You can find a copy of BIBLIO.MDB in the \CODE\DATABASES directory.) This will associate the database with the alias WebPages through the ODBC Data Source Administrator. Click OK. The data source is now established, and you can exit the ODBC Data Source Administrator.
Maximize Visual InterDev again. Now you will add the data source to your web project. On the FileView tab, click the project title, and then choose Add To Project/Data Connection from the Project menu. When the Select Data Source dialog box appears, click the Machine Data Source tab, select the WebPages data source, and click the OK button.
Visual InterDev will add a new data connection to your web project based on the WebPages data source. This is the database that you will use to display books for sale on the site.
Note that Visual InterDev has added a new tab to your project window, the Data View tab. Click this tab, and you can view the database structure. If you double-click any table, Visual InterDev even allows you to view and edit the data.