FP98: How to Post Information to a Database Using ASP

Last reviewed: March 18, 1998
Article ID: Q175770
The information in this article applies to:
  • Microsoft FrontPage 98 for Windows
  • Microsoft Access 97

SUMMARY

This article describes how to post new information to a Microsoft Access 97 database using FrontPage 98 and 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:

  • A 32-bit ODBC driver.
  • One of the following servers:

        - Microsoft Internet Information Server (IIS) 2.0 or 3.0 for
          Microsoft Windows NT Server.
    

        - Microsoft Peer Web Services for Microsoft Windows NT Workstation.
    

        - Microsoft Personal Web Server for Microsoft Windows 95.
    
  • An ASP engine on the IIS derivative Web server.
  • FrontPage 98 Server Extensions.

Posting Information to a Microsoft Access Database Using ASP

To posting information to a Microsoft Access database using ASP, follow these steps:

  1. Start Microsoft Access 97 and follow these steps:

        a. Create a database that includes one table. Name the table
           "Employees" (without the quotation marks).
    

        b. Insert four fields and name them as follows:
    

             EmployeesID
             FirstName
             LastName
             EmailName
    
        c. 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:

        a. On the File menu, point to New, and click FrontPage Web.
    

        b. In Step 1, click One Page Web.
    

        c. In Step 2, click Change.
    

        d. In the "Please specify a location of the New FrontPage Web" box,
           type the following:
    

             http://localhost/ASPWeb
    
        e. In the "Choose a title for your FrontPage Web" box, type "ASPWeb"
           (without the quotation marks).
    
        f. Click OK twice.
    
    

  3. On the View menu, click Folders.

  4. Import the Microsoft Access 97 database file into FrontPage Explorer, by following these steps:

        a. On the File menu, click Import.
    

        b. Click Add file.
    

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

        d. Click OK.
    

  5. Create an executable folder by following these steps:

        a. On the File Menu, point to New, and click Folder.
    

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

        c. Press ENTER.
    

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

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

        f. Click OK.
    

  6. Create a system Data Source Name (DSN) by following these steps:

        a. On the Windows Start menu, point to Settings, and then click
           Control Panel.
    

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

        c. Click the System DSN tab.
    

        d. Click Add.
    

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

        f. In the Data Source Name box, type the name you want. For example,
           type "Aspdemo" (without the quotation marks). Note that the DSN
           name should not include any spaces.
    

        g. Click Select.
    

        h. 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
    
        i. Click OK three times.
    
    

  7. In FrontPage Editor, create a form that contains three one-line text boxes by following these steps:

        a. In FrontPage Explorer, double-click the Default.htm file.
    

           The file will be opened in FrontPage Editor.
    

        b. On the Insert menu, point to Form Field, and click One-Line Text
           Box.
    

           NOTE: When you insert the first form field, the Submit and
           Reset buttons will be present on the form. These will appear to
           the right of the form field. If you want to move these buttons
           to a new line in the form, click in front of the first form
           field and then press ENTER.
    

        c. Click to the left of the one-line text box form field.
    

        d. Type "First Name:" (without the quotation marks).
    

        e. Select the text box and the text that you typed in step d.
    

        f. On the Insert menu, point to Form Field, and click Label.
    

        g. Right-click the one line text box and then click Form Field
           Properties on the menu that appears.
    

        h. In the Name box, type "FirstName" (without the quotation marks).
           Click OK.
    

        i. Press the RIGHT ARROW key and then press ENTER.
    

        j. On the Insert menu, point to Form Field, and click One-Line Text
           Box.
    

        k. Repeat steps b through i for the remaining two fields (LastName
           and EmailName).
    

        l. Right-click the Submit button and then click Form Properties on
           the menu that appears.
    

        m. Click Send To Other and select the "Custom ISAPI, NSAPI, CGI, or
           ASP Script" option in the Send To Other list.
    

        n. Click Options.
    

        o. In the "Options for Custom Form Handler" dialog box, in the Action
           box, type "ASP/posts.asp" (without the quotation marks).
    

        p. Click OK twice.
    

        q. On the File menu, click Save.
    

  8. In FrontPage Editor, create the ASP page by following these steps:

        a. On the File menu, click New, and then click the Page tab.
    

        b. Double-click Normal Page.
    

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

        d. In the "ODBC Data Source Name (DSN)" box, type "ASPDemo" (without
           the quotation marks). Click Next.
    

        e. In the "Enter the SQL string for the query" box, type the
           following SQL code:
    

             Insert into Employees (FirstName, LastName, EmailName) values
             ('%%FirstName%%','%%LastName%%','%%EmailName%%')
    
           NOTE: The field names, FirstName, LastName, and EmailName,
           represent the fields used in the Aspsamp.mdb file. The fields,
           %%FirstName%%, %%LastName%%, and %%EmailName%% represent the
           one-line text box form fields.
    
           Click Next.
    
        f. Click Add Field.
    
        g. In the Add Field dialog box, type "EmployeesID" (without
           the quotation marks). Click OK.
    
        h. Repeat Steps f and g for each of the remaining fields (FirstName,
           LastName, and EmailName) that you created in step 1.
    
        i. Click Finish.
    
        j. Click OK.
    
        k. 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
           "posts.asp" (without the quotation marks) and click Save.
    
    

  9. Open the page in your Web browser, fill in the form fields, and submit the form.

    NOTE: After you click Submit, you will receive a "No Records Returned" message. Start or switch to Microsoft Access and open the Aspsamp.asp file. Note that new information will have been added to the database.

    For more information, please see the following article in the Microsoft Knowledge Base:

           Article-ID : Q177082
    
           TITLE      : FP98: "No Records Returned" Received When Posting to
                        Database
    
    

REFERENCES

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

    ARTICLE-ID : Q174008
    TITILE     : FP98: What are Active Server Pages?

    ARTICLE-ID : Q174015
    TITLE      : FP98: How to Create Active Server Pages in FrontPage 98

    ARTICLE-ID : Q175771
    TITLE      : FP98: How to Display Contents of a Database Using ASP


Additional query words: 98 iis asp fpodbc
Keywords : fpiis fpodbc kbdta
Version : WINDOWS:98
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 18, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.