Running "insert_access.asp"

This section provides a tutorial example on running the test script, insert_access.asp, persist data to MS Access database using the Execute() method to run an INSERT statement.

To run the script described in the previous section, I copied it to my local IIS server as "c:\inetpub\wwwroot\insert_access.asp".

Then I opened Internet Explorer with http://localhost/insert_access.asp. This time I got a page crash message:

Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/insert_access.asp, line 9

What's wrong? I had no idea when I saw this message. But searching on the Internet helped me. This error was caused by lack of "write" permission given to the IIS server.

By default, IIS server is given "read" permission to almost all files on server's hard disk. But it has no "write" permission any files. Here is how to fix this on Windows XP system:

1. Making sure that IIS directory setting on /cgi-bin/ has "read" and "write" checked. Go to Control Panel > Administrative Tools > Internet Information Services > local computer > Web Sites > Default Web Site > cgi-bin. Right mouse click to select "Properties". On the "Directory" tab, you will see "read" and "write" checked.

2. Finding out that IIS is using which Windows account to access cgi-bin directory. Following same process as in step 1 to invoke the "Properties" dialog box window of the cgi-bin directory. On the "Directory Security" tab, click the "Edit" button in the "Anonymous access and authentication control" section. The "Authentication Methods" window shows up. The "Anonymous access" should be checked. "IUSR_computername" should be in the "User name" field.

3. Making sure that "simple file sharing" is turned off on you system. Go to Control Panel > Folder Options. On the View tab, "Use simple file sharing" should be unchecked.

4. Giving "write" permission to "IUSR_computername" on "\inetput\wwwroot\cgi-bin\" directory. On Windows Explorer, right mouse click on "\inetput\wwwroot\cgi-bin\" to select "Properties". On the Security tab, click the "Advanced" button. The advanced security settings dialog box shows up. Uncheck the "Inherit parent permission entries that apply to child objects." Click "Copy" when prompted to copy all permission from parent directory. Click "OK" to close advanced security settings.

Back on the cgi-bin directory properties dialog box, click "Add" to add a new user account called "IUSR_computername". Remember this user account must be the same used by IIS to access this directory, see step 2. Now "Internet Guest Account" should be listed on the "Security" tab. Select "Internet Guest Account", Make sure the "Read" and "Write" are both checked under the "Allow" column.

4. Giving "write" permission to "IUSR_computername" on "\inetput\wwwroot\cgi-bin\hello.mdb" file. Repeat the same process listed in Step 3 for "hello.mdb" file.

Then I tried again with Internet Explorer on http://localhost/insert_access.asp. I got:

Hello world!
I am here.

Perfect, right? If you refresh the page, a new line will be added to the end.

Notes on this test:

Table of Contents

 About This Book

 ASP (Active Server Pages) Introduction

 IIS (Internet Information Services) 5.0

 MS Script Debugger

 VBScript Language

 ASP Built-in Run-time Objects

 ASP Session

 Creating and Managing Cookies

 Managing Sessions with and without Cookies

 scrrun.dll - Scripting Runtime DLL

 Managing Response Header Lines

 Calculation Speed and Response Time

 ADO (ActiveX Data Object) DLL

Working with MS Access Database

 Connecting ASP Pages to MS Access Databases

 "hello_access.asp" - MS Access Example

 Persisting Data to MS Access Databases

Running "insert_access.asp"

 Protecting Data in SQL Statements

 Protecting Data in SQL Statements - Test Script

 Guest Book Application Example


 Full Version in PDF/EPUB