SoFunction
Updated on 2025-04-08

Access database prompts OleDbException (0x80004005): The operation must use an updateable query

Description: An unhandled exception occurred during the execution of the current web request. Please check the stack trace information for details about the error and where the error was caused in the code.

Exception details: : Unable to delete from the specified data table.

Source error:


Line 37: = sqlstr;
Line 38: //();
Line 39: cout = ();
Route 40:
Line 41: ();


Source file: d:\SOVO acceptance code\Base\App_Code\ Line: 39

[OleDbException (0x80004005): Unable to delete from the specified data table. ]
(tagDBPARAMS dbParams, Object& executeResult) +267
(Object& executeResult) +192
(CommandBehavior behavior, Object& executeResult) +48
(CommandBehavior behavior, String method) +106
() +108
(OleDbParameter[] parameters, String sqlstr) in d:\SOVO acceptance code\Base\App_Code\:39
(Int32 id) in d:\SOVO acceptance code\Base\App_Code\:29
_Default.GridView1_RowDeleting(Object sender, GridViewDeleteEventArgs e) in d:\SOVO acceptance code\Base\System\:46
(GridViewDeleteEventArgs e) +133
(GridViewRow row, Int32 rowIndex) +604
(EventArgs e, Boolean causesValidation, String validationGroup) +1155
(String eventArgument) +199
(String eventArgument) +7
(IPostBackEventHandler sourceControl, String eventArgument) +11
(NameValueCollection postData) +174
(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

The solution is as follows:
Right-click on the data file *.mdb to open the properties dialog box. Under the 'Safe' tab, you need to add IUSR_XXX (XXX is your machine name), that is, add an Internet Guest Account, and then set the permissions of this account to be readable and writable. (So ​​it was solved so simply, I'm damn :) )
If the 'Safe' tag cannot be found in the right-click properties dialog box, you need to remove the 'Use Simple File Sharing (Default)' checkmark in the view under Folder Options.

reason:
There are several main reasons for error:
This error occurs when your program tries to perform update database or other similar operations. This is because
ADO cannot write a database due to the following reasons.
1. The most common reason is that the anonymous user account (IUSR_MACHINE) does not have write permissions to the database file.
To solve this problem, adjust the properties of the database file in the manager to give anonymous users the correct permissions.
When using ACCESS database, you must not only give permission to write files, but also give permission to write the directory, because
Jet needs to create a .ldb file in this directory.
2. The second reason is that the database is not opened in the correct mode. It should be opened using the following method.
SQL = "UPDATE Products Set UnitPrice = 2;"
Set Conn = ("")
= 3 ''3 = adModeReadWrite
"myDSN"
(SQL)

Note that the default Mode is set to 0 (adModeUnknown), which allows updates.
3. It is also possible to select the read-only option of the DSN in the ODBC manager.
4. You are updating fields in two tables at the same time, and this error message will also appear. The solution is to update them separately.
Each of these two tables is the fields.
5. When you use a load from a lower version (such as ACCESS2.0, ACCESS7.0) to a higher version (ACCESS 2000)
When executing the query, the error will occur.