Can't update/write to Access 2000 database?

Calibus
Calibus used Ask the Experts™
on
I'm using Access 2000 on WinXP, with System DNS via ODBC. I can read records from the database just fine, but when I try to write or change a record I get 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.
/saveParms.inc, line 28

Here's the code:

<!-- #include file="adovbs.inc" -->

<script language=vbscript runat=server>

Function saveParmsToDb()
  Dim objConn
  Dim objRS

  'Create and open the database connection object
  Set objConn = Server.CreateObject("ADODB.Connection")
  objConn.Open "DSN=Licenses"

  Set objRS=Server.CreateObject("ADODB.RecordSet")
     objRS.CursorType = adOpenKeyset
     objRS.LockType = adLockOptimistic
 
  'Open the table tblParms
  'objRS.Open "tblParms",objConn, , ,adCmdTable
     objRS.Open "SELECT * FROM tblParms", objConn, adOpenStatic, adLockOptimistic

     Response.Write objRS("Version") & "<P>"
         
     objRS.AddNew

  objRS.Fields("Version") = Session("txtVersion")
  'objRS.Fields("Expiration") =  Session("txtExpiration")

  objRS.Update

     'display new name
     'Response.Write objRS("Version") & "<P>"

  objRS.Close

  Set objRS = Nothing
  Set objConn = Nothing

  saveParmsToDb = "A1"    'return successCode

End Function


</script>

Any ideas?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Are you maybe working in a network and someone else has the file open and thus locked for update?
Commented:
And another thing... top of my head...
Try using a pessimistic locked recordset.
adLockPessimistic is the name of the adodb constant.
Commented:

Hi,

You may have already checked this, but have you looked at what the file permissions are ? I have found that sometimes the database gets copied to the server, but the premissions are left as a read only. Hence you could read the file fine but not be able to write to it.

How you check depends upon the operating system in use. In windows 2000, you right click, select properties and check the security tab.  

You need to make sure that the IUSR_{machine name} user has write premissions. This is the user that IIS will use to run the ASP script. If that user is not present in the security list then first add them and then make sure they have write permissions.

Sorry if you have already tried this.

Regards
dnb
Just to add on from DNB's suggestion:

If you are changing the permissions on your server, you may want to put the database in a directory all on it's own. Otherwise your whole website will be open to abuse from people who may want to steal/modify your source code and other documents.

Jon

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial