FP98: How to Display Contents of a Database Using ASP

ID: Q175771


The information in this article applies to:


SUMMARY

This article describes how to display the contents of an existing database using Active Server Pages (ASP).


MORE INFORMATION

Getting Ready to Use the ASP Features in FrontPage 98



Before you can use the ASP features in FrontPage 98, you must install the following components:

Displaying the Contents of a Database using ASP

To display the contents of a database by using ASP, follow these steps:

  1. Start Microsoft Access 97 and do the following:
    1. Create a database that includes one table. Name the table "Employees" (without the quotation marks).


    2. Insert four fields and name them:
      
                EmployeesID
                FirstName
                LastName
                EmailName 


    3. Save the table and switch to Design view.


    4. Enter one record into the table using your first name, last name and e-mail name.


    5. On the File menu, click Save. In the File Name box, type "Aspsamp.mdb" (without the quotation marks) and click Save.




  2. Start FrontPage Explorer and create a new Web by following these steps:
    1. On the File menu, point to New, and click FrontPage Web.


    2. In Step 1, click One Page Web.


    3. In Step 2, click Change.


    4. In the "Please specify a location of the New FrontPage Web" box, type the following:
      
      http://localhost/ASPWeb 


    5. In the "Choose a title for your FrontPage Web" box, type "ASPWeb" (without the quotation marks).


    6. Click OK twice.




  3. On the View menu, click Folders.


  4. Import the Microsoft Access 97 database file into FrontPage Explorer. To do this, follow these steps:
    1. On the File menu, click Import.


    2. Click Add file.


    3. Click Browse, select the file you created in step 1, and then click Open.


    4. Click OK.




  5. Create an executable folder by following these steps:
    1. On the File Menu, point to New, and click Folder.


    2. Name the folder "ASP" (without the quotation marks).


    3. Press ENTER.


    4. Right-click the ASP folder and click Properties on the menu that appears.


    5. Click to select the "Allow scripts or programs to be run" check box.


    6. Click OK.




  6. Create a system Data Source Name (DSN). To do this, follow these steps:
    1. On the Windows Start menu, point to Settings, and then click Control Panel.


    2. Double-click the 32bit ODBC icon (Windows 95) or the ODBC icon (Windows NT).


    3. Click the System DSN tab.


    4. Click Add.


    5. Select the driver you want to use. For example, select "Microsoft Access Driver (*.mdb)." Click Finish.


    6. In the Data Source Name box, type the name you want. For example, type "Aspdemo." Note that the DSN name should not include any spaces.


    7. Click Select.


    8. Select the database file you want to use (for example, select Aspsamp.mdb). The file will be located in one of the following IIS Web server locations:

      - Personal Web Server for Windows 95:

      C:\Webshare\Wwwroot\Aspweb\Aspsamp.mdb

      - Internet Information Server for Windows NT Server:

      C:\InetPub\Wwwroot\Aspweb\Aspsamp.mdb

      - Microsoft Peer Web Services for Windows NT Workstation:

      C:\InetPub\Wwwroot\Aspweb\Aspsamp.mdb


    9. Click OK three times.




  7. On the Tools menu, click Show FrontPage Editor.


  8. On the Insert menu, point to Database, and click Database Region Wizard.


  9. In the Database Region Wizard, do the following:
    1. In the "ODBC Data Source Name (DSN)" box, type "Aspdemo" (without the quotation marks). Click Next.


    2. In the "Enter the SQL string for the query" box, type the following SQL code:
      
      SELECT * from Employees 
      Click Next.


    3. Click Add Field.


    4. In the Add Field dialog box, type "EmployeesID" (without the quotation marks). Click OK.


    5. Repeat steps c and d for each of the remaining fields (FirstName, LastName, and EmailName) that you created in step 1.


    6. Click Finish.


    7. Click OK.




  10. On the File menu, click Save. In the Save As dialog box, select the ASP folder you created in step 5. In the File Name box, type "display.asp" (without the quotation marks) and click Save.


  11. Open the page in your Web browser.



REFERENCES

For more information about Active Server Pages in FrontPage 98, please see the following articles in the Microsoft Knowledge Base:

Q174008 FP98: What are Active Server Pages?
Q174015 FP98: How to Create Active Server Pages in FrontPage 98
Q175770 FP98: How to Post Information to a Database Using ASP

Additional query words: 98 asp iis fpodbc


Keywords          : kbdta fpedit fpiis 
Version           : WINDOWS:97
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: July 1, 1999