Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with this code?

Status
Not open for further replies.

longmatch

Programmer
Nov 1, 2001
406
I just got this code from chapter 15 of the booK titled "Beginning Active Server Pages 3.0". When I ran this piece of codes, I got this message:

Error Type:
Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/ch15/AddUser.asp, line 13

I do not know why. I did change the cursor type from adOpenForwardOnly to adOpenDynamic. Unfortunately it did not work. I am hoping you can give me the answer and fix it.

Thank you in advance

Haijun

<%
Dim rsUsers
Set rsUsers = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsUsers.Open &quot;Person&quot;, objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable

If Session(&quot;PersonID&quot;) <> &quot;&quot; Then ' currently logged-on user
rsUsers.Filter = &quot;PersonID = '&quot; & Session(&quot;PersonID&quot;) & &quot;'&quot;
Else ' New session
rsUsers.Filter = &quot;EMailAddress = '&quot; & Request.Form(&quot;email&quot;) & &quot;'&quot; & _
&quot;AND Password = '&quot; & Request.Form(&quot;password&quot;) & &quot;'&quot;
If rsUsers.EOF Then ' User not found
rsUsers.AddNew ' ...so add a new record
' Else
' Email address and password matched with DB records -
' In this case we'll allow this to update user's personal details
End If
End If
' write personal details to record
rsUsers(&quot;EMailAddress&quot;) = Request.Form(&quot;email&quot;)
rsUsers(&quot;Password&quot;) = Request.Form(&quot;password&quot;)
rsUsers(&quot;FamilyName&quot;) = Request.Form(&quot;FamilyName&quot;)
rsUsers(&quot;GivenName&quot;) = Request.Form(&quot;GivenName&quot;)
rsUsers(&quot;StreetAddress1&quot;) = Request.Form(&quot;Address1&quot;)
rsUsers(&quot;StreetAddress2&quot;) = Request.Form(&quot;Address2&quot;)
rsUsers(&quot;City&quot;) = Request.Form(&quot;City&quot;)
rsUsers(&quot;State&quot;) = Request.Form(&quot;State&quot;)
rsUsers(&quot;PostalCode&quot;) = Request.Form(&quot;PostalCode&quot;)
rsUsers(&quot;Country&quot;) = Request.Form(&quot;Country&quot;)
rsUsers(&quot;Active&quot;) = True
rsUsers(&quot;LastLogin&quot;) = Now
rsUsers.Update ' update the database

Dim strName, strValue ' create session variables
For each strField in rsUsers.Fields
strName = strField.Name
strValue = strField.value
Session(strName) = strValue
Next
Session(&quot;blnValidUser&quot;) = True ' declare that current user is validated
Response.Redirect &quot;MenuForRegisteredUsers.asp&quot;
%>
 
Maybe the database attribute is read only. If you copied the file from a CD to the HDD then the file will be read only. Did you checked that?
 
When I checked the property of the database property, the read-only checkbox was not checked. Is this the correct way to check it and What do I need to do next?

Thanks

Haijun
 
Try to insert the record manually, see if you get the same error!
 
Your suggestion is very good. It at least gives me the idea how to find the problem. I tried it, it looks ok. I inserted one record in the table, saved it and can see the record after I reopened my database.

Haijun
 
When I checked the information about 0x80040E09 on Microsoft website, It said the reason is due to &quot;Permission Denied&quot;. What does it mean?

Haijun
 
check the actual file and directory security and make sure that IUSR_MACHINENAME is added to it's list of users with MODIFY rights. if not, then add the user and check MODIFY and apply .

Also, there's a chance that you have to give write-permissions to the Temp folder of Windows, because Access may want to write there as well.
 
I just changed the permission of the directory in which my files located. It works, thank you.

Haijun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top