Access database Prompts OleDbException (0x80004005): The operation must use an updatable query _access

Source: Internet
Author: User
Tags anonymous stack trace access database
Note: An unhandled exception occurred during the execution of the current WEB request. Check the stack trace for more information about the error and where the error occurred in the code.

Exception Details: System.Data.OleDb.OleDbException: Could not be removed from the specified datasheet.

SOURCE Error:


Row 37:comm.commandtext = Sqlstr;
Line://comm. Prepare ();
Row 39:cout = Comm. ExecuteNonQuery ();
Line 40:
Line 41:conn. Close ();


Source file: D:\SOVO Acceptance code \base\app_code\jetaccess.cs line: 39

[OleDbException (0x80004005): Could not be removed from the specified datasheet. ]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult (Tagdbparams dbparams, object& executeresult) +267
System.Data.OleDb.OleDbCommand.ExecuteCommandText (object& executeresult) +192
System.Data.OleDb.OleDbCommand.ExecuteCommand (CommandBehavior behavior, object& executeresult) +48
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal (CommandBehavior behavior, String method) +106
System.Data.OleDb.OleDbCommand.ExecuteNonQuery () +108
Jetaccess.execute (oledbparameter[] parameters, String sqlstr) in D:\SOVO acceptance code \base\app_code\jetaccess.cs:39
Newsdata.deletenews (Int32 ID) in D:\SOVO acceptance code \base\app_code\newsdata.cs:29
_default.gridview1_rowdeleting (Object sender, Gridviewdeleteeventargs e) in D:\SOVO acceptance code \base\system\default.aspx.cs : 46
System.Web.UI.WebControls.GridView.OnRowDeleting (Gridviewdeleteeventargs e) +133
System.Web.UI.WebControls.GridView.HandleDelete (GridViewRow row, Int32 rowIndex) +604
System.Web.UI.WebControls.GridView.HandleEvent (EventArgs E, Boolean causesvalidation, String validationgroup) +1155
System.Web.UI.WebControls.GridView.RaisePostBackEvent (String eventargument) +199
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent (String eventargument) +7
System.Web.UI.Page.RaisePostBackEvent (IPostBackEventHandler sourcecontrol, String eventargument) +11
System.Web.UI.Page.RaisePostBackEvent (NameValueCollection postdata) +174
System.Web.UI.Page.ProcessRequestMain (Boolean includestagesbeforeasyncpoint, Boolean includestagesafterasyncpoint ) +5102

The workaround is as follows:
Right-click on the data file *.mdb to open the Properties dialog box, under the ' Security ' tab, you need to add iusr_xxx (XXX is your machine name), that is, add the Internet Guest account, and then set the permissions for this account to be readable and writable. (originally so simple to solve the problem, I:))
If the ' Security ' tab is not found in the Right Key Properties dialog box, you need to remove the ' Use Simple File sharing (default) ' Check in the view under Folder Options.

Reason:
There are several main reasons for the error:
This error occurs when your program attempts to perform an updated database or other similar operation. This is because
ADO is not able to write a database because of several reasons below.
1. The most common reason is that the anonymous user account (Iusr_machine) does not have write access to the database file.
To resolve this problem, adjust the properties of the database file in the organizer so that anonymous users have the correct permissions.
When using an Access database, not only the permissions to write to the file, but also the permissions to write to the directory, because
Jet needs to create a. ldb file in this directory.
2. The second reason is that the database is not open with the correct mode. You should open it using the following method.
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 that the default mode is set 0 (adModeUnknown), which is allowed to be updated.
3. It is also possible to select the Read-only option for this DSN in the ODBC Administrator.
4. You are updating the fields in two tables at the same time, this error message appears, and the solution is to update it separately
The respective fields in the two tables.
5. When you use a load from a lower version (such as access2.0,access7.0) to a higher version (ACCESS 2000)
This error occurs when you execute the query in.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.