Viewing a Database in a Browser

Using a database to collect information left by visitors is a safe and simple way to make your Web site more useful. Once information is entered into a database, you can either open the database in the application in which it was originally created, or you can set up a Web page containing another script so you can view and edit the data with a Web browser. This topic provides a sample script you can use without editing to view the sample database provided with IIS. You can give visitors access to this script if you want them to be able to view the database. You can also customize the script to delete data in the sample database, or you can change the script to view other databases you have created.

To view the sample database in a browser
  1. Copy Viewdb.asp from your Winnt\Help\Iishelp\Iis\Htm\Core directory to Winnt\System32\Inetsrv\Iisadmin\Tour directory.
  2. Open your browser and connect to http://Localhost/Iisadmin/Tour/Viewdb.asp.
  3. Tip   If you plan to view your database frequently, add this address to your Favorites list by using the Favorites feature of your Web browser. When you view the database, always refresh the page to be sure you are seeing the current data, and not a cached copy that is out of date.

    Important   The Tour folder has special permissions that prevent access to any pages stored here, unless the access is made from the local computer. Remote visitors are not able to view the contents of the Tour folder in their browsers.

 

To delete entries from the database by using a browser
  1. Copy Viewdb.asp from your Winnt\Help\Iishelp\Iis\Htm\Core directory to Winnt\System32\Inetsrv\Iisadmin\Tour directory.
  2. Open the file in a text editor, such as Notepad.
  3. Search for the text 'Response.Write "<td width=><center>Delete Record</center></td>" and remove the apostrophe at the beginning of the line.
  4. Search for the text 'Response.Write "<td align=left valign=top bgcolor='#ffffff'><a href=viewdb.asp?id=" & rst(0) & ">Delete</a></td>" and remove the apostrophe at the beginning of the line.
  5. Save the file in text-only format with the name Viewdb.asp.
  6. Tip   To prevent Notepad from adding .txt to the file name, select All Files(*.*) as the Save as Type option.

  7. Open your browser and connect to http://Localhost/Iisadmin/Tour/Viewdb.asp.
  8. To delete a row, click the Delete link in the left column of the row.
  9. Caution   Deleting a row cannot be undone.

 

To allow visitors to view or delete database entries
  1. Copy Viewdb.asp from your Winnt\Help\Iishelp\Iis\Htm\Core directory to your home directory. (C:\Inetpub\Wwwroot is the default home directory used by Setup).
  2. Search for the text 'Database path statement for restricted viewing of the database. and place an apostrophe in front of the strProvider line directly below it.
  3. Search for the text 'Database path statement to allow visitors to view the database. and remove the apostrophe in front of the strProvider line directly below it.
  4. If you want visitors to be able to delete entries in the database, make the modifications described in the earlier deleting entries procedure.
  5. Add a link to the Viewdb.asp page on your home page.

Related Topics


© 1997-1999 Microsoft Corporation. All rights reserved.