• subscribe
December 01, 1997 12:00 AM

Use Microsoft Access 97 and Peer Web Services to Create Searchable Databases

Windows IT Pro
InstantDoc ID #555
PART 1: Help Sly Slick get Dodgy Motor Company's cars on the Internet highway

Sly Slick, the president of the Dodgy Motor Company (DMC), wants DMC to go high tech. When Sly was surfing the Web recently, he noticed that many Web pages had database searches to help viewers find information quickly. So he has asked you to set up a Web page with a database search of DMC's used car inventory. Sly wants car buyers to be able to search his inventory by a car's make, model, and model year.

For the database search, you can use a Web form that searches a Web server database. You can use Microsoft Access 97 and the Peer Web Services built into Windows NT 4.0 Workstation to create a dynamic Web page that contains the Web form and searches the database.

Screen 1, page 164, shows an example of a Web form that you can create. This form searches a database of DMC's used cars. The Web form has three fields: two text fields and a numeric field for the make, model, and model year, respectively.

If you leave all the fields blank and click on Run Query, you get a table that lists all the used cars in the DMC inventory, as shown in Screen 2, page 164. For each of DMC's four cars, the table includes the make, model, model year, and a hyperlink. If you click on the hyperlink, you get a picture of the car.

To narrow the search, you can type Hon in the [Enter Make] field and click on Run Query. This time only the two Hondas are in the table.

You can narrow the search even further by typing in 1994 in the [Enter Year] field and Hon in the [Enter Make] field. In this search, only the Honda Accord appears in the table.

You just conducted three types of searches. The first search left all the fields blank. The second search used a partial match of a text field in the database. The third search used a partial text match and a full integer match. In addition, you returned a hyperlink to another file on the system, which in turn, pointed to a picture (although the file could have pointed to another HTML file).

Now that you know the types of searches possible with this form, I will show you how to set up the database, make the database accessible to the Web, and set up an integer search. Part 2 of this two-part series, which will be in an upcoming issue, will look at how to set up text searches and hyperlinks.

Setting Up Peer Web Services
From an account with Administrator privileges, go to the Network applet (in Control Panel), select the Services tab, and add the Microsoft Peer Web Services (PWS). When NT prompts you to install the Open Database Connectivity (ODBC) drivers, select SQL Server. If you are installing PWS on your C: drive, the default directory for the program will be c:\WINNT\system32\inetsrv. If you install PWS in a different directory, make sure the directory name does not include a space (e.g., c:\Program Files). Otherwise, the shortcuts in the Start menu might not function correctly.

After installing PWS, go to the Microsoft Peer Web Services group in the Start menu and select the Internet Service Manager (ISM) icon to see what services are available. Three services appear: a WWW service, a Gopher service, and an FTP service. Select the WWW service, and then double-click on it. You will get a list of WWW service properties arranged in a tabbed dialog.

The Service tab lists the name of the account used for anonymous logon when someone accesses your site. If you have an NTFS-formatted disk, you can use NT's built-in security to limit access to your site. But if the people accessing your site will not be using Internet Explorer (IE), you must check the Password Authentication Basic (Clear Text) box. Be aware that if you select clear text, you will be using unencrypted passwords on the Internet.

The Directories tab lists the directories and the Default Document (i.e., what people see if they just type in your Internet address) that the WWW service uses. When you click on the Directories tab, you will see a scripts directory. Edit the properties of this directory to permit both execute and read access. You need both permissions to put the initial Web form in the scripts directory.

Installation of the WWW services creates a default homepage called default.html under the Inetpub\wwwroot directory. When you activate the WWW server, users can access Web pages on your server by typing the command

http://mycomputer

where mycomputer is your machine's name (including the Internet domain).

Setting Up the Database
Install Office 97 Professional, open Access 97, select Create a Blank Database, and name the database DMC.mdb. These steps will bring up a tabbed dialog with the Tables tab selected. Click on New to generate a new table, and select Datasheet View. Key in the data under the Make, Model, and Year columns of the table shown in Screen 3. (Do not key in the ID data or the column headings.) Make certain that the Make data appears under Field 1, the Model data appears under Field 2, and the Year data appears under Field 3.

Switch to the Design View by right clicking the title bar of the table. When Access 97 asks you to name the table, type Inventory. Access 97 will also ask whether you want a primary key. Say Yes. Next, change the names of Fields 1, 2, and 3 to Make, Model, and Year. Note that the table doesn't include the hyperlink shown in Screen 2. You will add the hyperlink later. Save and then close the table.



ARTICLE TOOLS

Comments
  • Mike Mahan
    13 years ago
    Aug 10, 1999

    Thanks to Simon Hook’s December 1997 article, “Use Microsoft Access 97 and Peer Web Services to Create Searchable Databases,” we can use wild card searches from anywhere in the plant to query our Access database. The article’s instructions were clear and concise, opening a new range of possibilities for our intranet. Thanks again for the help.

    --Mike Mahan

  • Chuck Lob
    13 years ago
    Aug 10, 1999

    Simon Hook’s December 1997 article, “Use Microsoft Access 97 and Peer Web Services to Create Searchable Databases,” couldn’t have been more timely. I got the example to work, but I have questions.
    I’m running Windows NT 4.0 Workstation on an NT 4.0 Server-based network and want to use the NT Workstation as a Web server for my small department intranet. The workstation has Peer Web Services (PWS) running with Service Pack 3 (SP3) per the article. Hook does not specify where to put the dmc.mdb file. If I put it in the C:\\inetpub\\scripts directory on the workstation where the YearQuery_1.xxx files are, I can get everything to work exactly the way the article showed. However, I’d rather have the dmc.mdb file on our network server, which gets backed up more frequently. If I set the dmc.mdb database in a directory on the network server and reestablish the Open Database Connectivity (ODBC) requirement to point to that file and run the example, I get the following error: >[State=S1000][Error=-1032] [Microsoft][ODBC Microsoft Access 97 Driver] The Microsoft Jet database engine cannot open the file ‘(unknown)’. It is already opened exclusively by another user, or you need permission to view its data.
    I checked permissions on the dmc.mdb file on the server, and I should have access to it. The file is not open. I get the same error when I log on as a domain administrator. Any ideas?

    --Chuck Lob



    Try this fix. On the server, place the file in a shared directory that you can access from the workstation. On the domain, create an account with access to the file on the server and to the workstation. Replace the account that Peer Web Services uses with the domain account. Create a new datasource that points to the file on the server. Specify the location to the database as \\\\machinenamesharename\\etc. If you don’t follow this step, you need a permanent connection to the shared drive as a network drive.
    By the way, this fix works only if you haven’t installed the NT 4.0 Option Pack. (For an overview of the Option Pack, see Ken Spencer, “The NT 4.0 Option Pack,” January 1998.) If anyone knows a solution with the Option Pack installed, send it our way.

    --Simon Hook

You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...