PRB: Causes of 'Operation Must Use an Updateable Query' Error

ID: Q175168


The information in this article applies to:


SYMPTOMS

The following is a common error encountered when using ActiveX Data Objects (ADO) with Active Server Pages:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access 97 Driver] Operation must use an updateable query.


CAUSE

This article explains the three primary causes of this error, and the workarounds. Although this article refers to Microsoft Access databases, the information provided here also applies to other types of databases.


RESOLUTION

This error is typically encountered when your script attempts to perform an UPDATE or some other action that alters the information in the database. This error occurs because ADO is unable to write to the database for one of the following reasons:

  1. The most common reason is that the Internet Guest account (IUSR_MACHINE) does not have Write permissions on the database file (.mdb). To fix this problem, use the Security tab in Explorer to adjust the properties for this file so that the Internet Guest account has the correct permissions. NOTE: When using Microsoft Access databases with ADO, it is also necessary to give the Internet Guest account Write permissions on the directory containing the .mdb file. This is because Jet creates an .ldb file to handle database locking.


  2. A second cause of this error is that the database was not opened with the correct MODE for writing. If you perform the Open on the Connection object, you use the Mode property to indicate the permissions on the connection as shown here:

    
    
          SQL = "UPDATE Products Set UnitPrice = 2;"
          Set Conn = Server.CreateObject("ADODB.Connection")
          Conn.Mode = 3      '3 = adModeReadWrite
          Conn.Open "myDSN"
          Conn.Execute(SQL)
          Conn.Close
     
    NOTE: By default, the MODE is set to 0(adModeUnknown), which generally allows updates.


  3. Another cause of this error is that the "Read Only" setting may be checked in the Options page for this DSN in the ODBC Manager.


  4. The last issue and work around pertains to any SQL data source. The error can be caused by SQL statements that violate referential integrity of the database. Here are a few of the most common queries that fail:




STATUS

This behavior is by design.

Additional query words: kbdsi


Keywords          : kberrmsg kbADO100 kbADO150 kbADO200 kbASP kbDatabase kbGrpASP 
Version           : WINDOWS:1.0,1.5,2.0; winnt:
Platform          : WINDOWS winnt 
Issue type        : kbprb 

Last Reviewed: May 27, 1999