The Access Database prompts OleDbException (0x80004005): one is required for the operation.

Source: Internet
Author: User
When using Access as a database, this problem is depressing for several days! [OleDbException (0x80004005): The operation must use an updatable query.]

When using Access as a database, this problem is depressing for several days! [OleDbException (0x80004005): The operation must use an updatable query.]

Note: An unhandled exception occurs during the execution of the current Web request. Check the stack trace information for details about the error and the source of the error in the code.

Exception details: System. Data. OleDb. OleDbException: the specified Data table cannot be deleted.

Source error:


Row 37: comm. CommandText = sqlstr;
Row 38: // comm. Prepare ();
Row 39: cout = comm. ExecuteNonQuery ();
Row 40:
Row 41: conn. Close ();


Source File: d: \ SOVO acceptance code \ Base \ App_Code \ JetAccess. cs line: 39

[OleDbException (0x80004005): The specified data table cannot be deleted.]
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 solution is as follows:
In the data file *. right-click mdb to open the Properties dialog box. Under the 'security' tab, you need to add IUSR_XXX (XXX for your machine name), that is, to add an Internet Guest Account, set the account permission to readable and writable. (The problem solved in this simple way, I rely on it :))
If the 'security' tag cannot be found in the right-click Properties dialog box, remove the 'use simple file sharing (default)' check box in the view under the folder option.

Cause:
There are several major error causes:
This error occurs when your program tries to update the database or perform other similar operations. This is because
ADO cannot write data to the database for the following reasons.
1. The most common cause is that an anonymous user account (IUSR_MACHINE) has no write permission on the database file.
To solve this problem, adjust the database file attributes in the manager so that anonymous users have the correct permissions.
When using the ACCESS database, you must grant not only the write permission to the file, but also the write permission to the directory, because
Jet needs to create a. ldb file in this directory.
2. The second reason is that the database is not enabled in the correct mode. Use 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 to 0 (adModeUnknown), which allows update.
3. You may also select the read-only option of The DSN In the ODBC manager.
4. This error message is also displayed when you update the fields in both tables. The solution is to update the fields separately.
The two tables have their own fields.
5. When you use an earlier version (such as ACCESS2.0 and ACCESS7.0) to load data to a later version (ACCESS 2000)
This error occurs when the query is executed.

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.