This article describes how to display images on your Web
site by using information from a Microsoft Access
database.
Microsoft provides programming examples for illustration only,
without warranty either expressed or implied. This includes, but is not limited
to, the implied warranties of merchantability or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language that is being demonstrated and with the tools that are used to create
and to debug procedures. Microsoft support engineers can help explain the
functionality of a particular procedure, but they will not modify these
examples to provide added functionality or construct procedures to meet your
specific requirements.
Install components before you use the ASP features in FrontPage
Before you can use the Microsoft Active Server Pages (ASP)
features in Microsoft Office FrontPage 2003, you must install the components
that are listed in Microsoft Knowledge Base article 825487. For
additional information, click the following article number to view the article
in the Microsoft Knowledge Base:
825487�
How to query Index Server data by using ASP in FrontPage 2003
Install FrontPage 2003 and Access 2003
The steps in this article require that you have Microsoft Office
FrontPage 2003 and Microsoft Office Access 2003 installed on the client
computer. FrontPage 2003 and Access 2003 are included with Microsoft Office
2003.
To create a new personal Web site, follow these steps:
- Start FrontPage.
- On the File menu, click
New.
- In the New task pane, click More
Web site templates.
- In the Web Site Templates dialog box,
click Personal Web Site.
- In the Specify the location of the new Web
site box, type the URL of a new personal Web site on a Web server that
supports Active Server Pages, such as:
http://mywebserver/mypersonalweb/
- Click OK to create the Web
site.
To add the sample database to the Web site, follow these steps:
- Click Create a new normal page on the
toolbar.
- On the Insert menu, point to
Database, and then click Results.
- On the first page of the Database Results Wizard, click
Use a sample database connection (Northwind), and then click
Next.
- Click Cancel.
To modify the Employees table in the database, follow these steps:
- On the View menu, click
Folders.
- Double-click the fpdb folder, and then
double-click the fpnwind.mdb file to open the file in
Access.
- Double-click the Employees table to open
it.
- On the View menu, click Design
View.
- At the end of the table, click in the first blank row to
add a new field to the table.
- Configure the new field as follows:
- In the Field Name column, type
FavoriteImage.
- In the Data Type column, click
Text.
- On the File menu, click
Save.
- On the View menu, click Datasheet
View.
- Type the following values in the FavoriteImage row for
each of the employees:
Collapse this tableExpand this table
Employee | FavoriteImage |
---|
Nancy Davolio | images/mycat.jpg |
Andrew Fuller | images/mount.gif |
All other employees | images/parrot1.jpg |
- To close the database and to return to FrontPage, click
Exit on the File menu.
- On the View menu, click
Refresh.
To add a Database Results region, follow these steps:
- On the View menu, click
Page.
- On the Insert menu, point to
Database, and then click Results.
- Follow these steps in the Database Results Wizard:
- In the list of existing database connections, click
Sample, and then click Next.
- In the Record source list, click
Employees, and then click Next.
- Click Edit List.
- Remove all fields except for the following fields:
- LastName
- FirstName
- FavoriteImage
- Click OK.
- Click Next two times, and then click
Finish.
- On the File menu, click
Save.
- Type imagetest.asp in the
File name box, and then click OK.
To add the image links to the database results, follow these
steps:
- Click the <<FavoriteImage>> value in the
FavoriteImage column, and then press DELETE.
- In the table cell where you just removed the
<<FavoriteImage>> value, insert the Mycat.jpg image from your Web
site. To do this, follow these steps:
- On the Insert menu, point to
Picture, and then click From file.
- Locate the Mycat.jpg image in the Image folder of your
Web site.
- Click the image, and then click
OK.
- Right-click the image, and then click Picture
Properties.
- Click the General tab.
- Click Parameters.
- In the Path box, remove the current
path.
- Click Insert Field Value,
and then click FavoriteImage.
- Remove the quotation marks from the start and end of the field
value.
- Click OK two times. You see a small,
broken image icon in the table column.
- Save the page, and then click Preview in
Browser
on the toolbar.