|
Hi All:
I have been trying to enter data from a form, using asp, to an Access database. I'm getting the following error:
Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. /MyWeb/add_to_db3.asp, line 52
I looked on the database error FAQ page for webwiz forums and thought I found the answer through the instructions, "checking and setting up the correct persmissions on the IIS Server" ( http://www.webwiz.net/asp/faq/server_permissions.asp - http://www.webwiz.net/asp/faq/server_permissions.asp ). However, I can't find the "IUSR_name_of_my_computer" necessary in Step 6. Can anyone help?
Here are my files:
add_to_db3.asp-
<html> <head> <title>Adding data to database</title> </head> <body>
Adding data to database...
<% 'Dimension variables
Dim conn Dim rs Dim strSQL
'Create an ADO connection object Set conn=Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN connection conn.Open "DSN=profiles"
'Create an ADO recordset object Set rs=Server.CreateObject("ADODB.Recordset")
strSQL="Facility"
'Open the recordset with the SQL query rs.Open strSQL,conn,1,3
'rs.CursorType=2 'Set the cursor type we are using so we can navigate through the recordset
'rs.LockType=3 'Set the lock type so that the record is locked by ADO when it is updated
rs.addNew 'Tell the recordset we are adding a new record to it.
rs.Fields("Facility_id")=Request.Form("Facility_id") rs.Fields("Facility_name")=Request.Form("Facility_name") rs.Fields("Facility_description")=Request.Form("Facility_description") rs.Fields("Street_address1")=Request.Form("Street_address1") rs.Fields("Street_address2")=Request.Form("Street_address2") rs.Fields("City")=Request.Form("City") rs.Fields("State")=Request.Form("State") rs.Fields("Zipcode")=Request.Form("Zipcode") rs.Fields("Website")=Request.Form("Website") rs.Fields("Image")=Request.Form("Image") 'Add a new record to the dataset
rs.Update 'Write the updated recordset to the database. Problems with this line!
'Reset server objects rs.Close Set rs=Nothing Set conn=Nothing
Response.Redirect "display_profile_db.asp" 'To display all the records in the database, including the new ones
%>
</body> </html>
form.asp:
<html> <head> <title>Profile Data Entry Form</title> </head>
<Body bgcolor="#0099CC" text="white" link="#0000FF" alink="#FF0000" vlink="#663399"> <font face = "Georgia"> <H1 Align="center">Profile Data Entry Form</H1> </font>
<form name="Form" method="post" action="add_to_db3.asp">
Facility_id <input type = "text" name="Facility_id" size = 10> <br> Facility_name <input type="text" name="Facility_name" size = 100> <br> Facility_description <input type="text" name="Facility_description" size = 1000> <br> Street Address1 <input type="text" name="Street_address1" size = 100> <br> Street_Address2 <input type="text" name="Street_address2" size = 100> City <input type="text" name="City" size = 50> State <input type="text" name="State" size = 10> <br> Zipcode <input type="text" name="Zipcode" size = 12> <br> Website <input type="text" name="Website" size = 50> <br> Image <input type="text" name="Image" size = 50> <br>
<p><input type="Submit" name="Submit" value="SUBMIT"></p>
</form> </body> </html>
|