Microsoft KB Archive/175770

= FP98: How to Post Information to a Microsoft Access Database Using ASP =

Article ID: 175770

Article Last Modified on 6/25/2007

-

APPLIES TO


 * Microsoft FrontPage 98 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q175770



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
Before you can use the ASP features in FrontPage, you must install the components listed in the following Microsoft Knowledge Base article:

312638 What You Need to Use Active Server Pages (ASP) in FrontPage

NOTE: If you want to use a database other than Access, the database must have a 32-bit ODBC driver. Otherwise, the steps are the same.

Posting Information to a Microsoft Access Database Using ASP
 Start Microsoft Access 97 and follow these steps:

 Create a database that includes one table. Name the table "Employees" (without the quotation marks). Insert four fields and name them as follows:

EmployeesID

FirstName

LastName

EmailName On the File menu, click Save. In the File Name box, type "Aspsamp.mdb" (without the quotation marks), and click Save.  Start FrontPage Explorer and create a new Web by following these steps:

 On the File menu, point to New, and click FrontPage Web.</li> In Step 1, click One Page Web.</li> In Step 2, click Change.</li> In the "Please specify a location of the New FrontPage Web" box, type the following:

http://localhost/ASPWeb

</li> In the "Choose a title for your FrontPage Web" box, type "ASPWeb" (without the quotation marks).</li> Click OK twice.</li></ol> </li> On the View menu, click Folders.</li> Import the Microsoft Access 97 database file into FrontPage Explorer. To do this, follow these steps:

 On the File menu, click Import.</li> Click Add File.</li> Click Browse, select the file you created in step 1, and then click Open.</li> Click OK.</li></ol> </li> Create an executable folder by following these steps:

 On the File Menu, point to New, and click Folder.</li> <li>Name the folder "ASP" (without the quotation marks).</li> <li>Press ENTER.</li> <li>Right-click the ASP folder and click Properties on the menu that appears.</li> <li>Click to select the "Allow scripts or programs to be run" check box.</li> <li>Click OK.</li></ol> </li> <li>Create a system Data Source Name (DSN) by following these steps:

<ol style="list-style-type: lower-alpha;"> <li>On the Windows Start menu, point to Settings, and then click Control Panel.</li> <li>Double-click the 32bit ODBC icon (Windows 95) or the ODBC icon (Windows NT).

In Windows 2000, double-click Administrative Tools, and double-click Data Sources (ODBC).</li> <li>Click the System DSN tab.</li> <li>Click Add.</li> <li>Select the driver you want to use. For example, select "Microsoft Access Driver (*.mdb)." Click Finish.</li> <li>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.</li> <li>Click Select.</li> <li>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:

<ul> <li>Personal Web Server for Windows 95:

C:\Webshare\Wwwroot\Aspweb\Aspsamp.mdb</li> <li>Internet Information Server for Windows NT Server/Windows 2000:

C:\InetPub\Wwwroot\Aspweb\Aspsamp.mdb</li> <li>Microsoft Peer Web Services for Windows NT Workstation:

C:\InetPub\Wwwroot\Aspweb\Aspsamp.mdb</li></ul> </li> <li>Click OK three times.</li></ol> </li> <li>Create a form that contains three one-line text boxes:

<ol style="list-style-type: lower-alpha;"> <li>In FrontPage Explorer, double-click the Default.htm file.

The file will be opened in FrontPage Editor.</li> <li>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.</li> <li>Click to the left of the one-line text box form field.</li> <li>Type "First Name:" (without the quotation marks).</li> <li>Select the text box and the text that you typed in step d.</li> <li>On the Insert menu, point to Form Field, and click Label.</li> <li>Right-click the one-line text box and then click Form Field Properties on the menu that appears.</li> <li>In the Name box, type "FirstName" (without the quotation marks). Click OK.</li> <li>Press the RIGHT ARROW key and then press ENTER.</li> <li>On the Insert menu, point to Form Field, and click One-Line Text Box.</li> <li>Repeat steps b through i for the remaining two fields (LastName and EmailName).</li> <li>Right-click the Submit button and then click Form Properties on the menu that appears.</li> <li>Click Send To Other and select the "Custom ISAPI, NSAPI, CGI, or ASP Script" option in the Send To Other list.</li> <li>Click Options.</li> <li>In the "Options for Custom Form Handler" dialog box, in the Action box, type "ASP/posts.asp" (without the quotation marks).</li> <li>Click OK twice.</li> <li>On the File menu, click Save.</li></ol> </li> <li>In FrontPage Editor, create the ASP page by following these steps:

<ol style="list-style-type: lower-alpha;"> <li>On the File menu, click New, and then click the Page tab.</li> <li>Double-click Normal Page.</li> <li>On the Insert menu, point to Database, and click Database Region Wizard.</li> <li>In the "ODBC Data Source Name (DSN)" box, type "ASPDemo" (without the quotation marks). Click Next.</li> <li> 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. </li> <li>Click Add Field.</li> <li>In the Add Field dialog box, type "EmployeesID" (without the quotation marks). Click OK.</li> <li>Repeat Steps f and g for each of the remaining fields (FirstName, LastName, and EmailName) that you created in step 1.</li> <li>Click Finish.</li> <li>Click OK.</li> <li>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.</li></ol> </li> <li>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.mdb 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:

182122 How to Remove or Customize the 'No Records Returned' Message

</li></ol>

<div class="references_section">