Link to home
Start Free TrialLog in
Avatar of networxplus

asked on

Operation must use an updateable query.

A customer of ours moved their website to our Windows 2003 Server. When they try to us the CMS to update the pages they get the error below. The company who designed their site is no longer in business and I cannot get in touch with anybody who designed it. From what I can tell they wrote the CMS themselves. I'm assuming they are getting this error because they could not update the database. I gave everyone full access to the database but it still did not work. Any help you can give me, I would really appreciate it.

Server Error in '/' Application.

Operation must use an updateable query.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:

[OleDbException (0x80004005): Operation must use an updateable query.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
   System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
   rizzetto.inprogress_edit.btnAdd_Click(Object sender, EventArgs e)
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1292


Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
Avatar of pauljk1619

What kind of database it is?  Looking at the trace, it seems that they were able to open the db, but not update it.  If it's a file based db, make sure the database files are not checked into source control and do not have the read only property flag set.
Avatar of networxplus


The database is *.mdb. Its an access database. That was the only database I was able to find and it had pretty much data in it so I am asssuming that is the right one.  How do I make sure the database files are not checked into source control?
Here's a link on ASPRunner, talking about debugging the Must use updatable query:

There's also a mention to having to set permissions to allow the IIS_WPG group to access the database.  I'm not sure if it's appropriate in this case, but it may throw some light on the problem.

To work around this problem, grant write access permission for the MDB file to both the IIS_WPG group and the Network Service. To do this, follow these steps:
1.      Log on as an administrator to the Microsoft Windows Server 2003-based computer that hosts your Web site.
2.      Click Start, right-click My Computer, and then click Explore.
3.      Expand the folder tree to the location of your Web site database file. For example, this file may be located in the following location:
C:\Documents and Settings\Administrator\My Documents\My Web Sites\Your_Web_Site_Name\fpdb
4.      Right-click Your_Web_Site_Database_Name.mdb, and then click Properties.
5.      Click the Security tab, and then click Add.
6.      In the Enter the object names to select box, type IIS_WPG, and then click OK.
7.      In the Group or user names list, click IIS_WPG.
8.      In the Permissions for IIS_WPG list, click to select the Allow check box that is next to Write.
9.      Click Add.
10.      In the Enter the object names to select box, type Network Service, and then click OK.
11.      In the Group or user names list, click Network Service.
12.      In the Permissions for Network Service list, click to select the Allow check box that is next to Write.
13.      Click Apply, and then click OK.

Avatar of YZlat
there must be a syntax error in your query
This is the same error I got when my mdb was in source control.   try right-clicking on the .mdb and see if the properties has read-only checked.  If so, uncheck it.  

My mdb was not on the 2003 platform, so I don't know if 2003 has different security features that need to be set, but it sounds like the same issue.  Write access is being denied.
that's not necessary true, YZlat...  I had the same error when I put my mdb in source control and then tried to run it.  It was read-only so I couldn't make updates to the database.  I'm not saying you are wrong, but I recieved that error because my mdb was locked.  Once I checked it out, the error was gone.  
Paul, I tried to do everything in your list and it did not work. I've checked to make sure that the database is not read only. I dont think it is a syntax error because it was working on the old server (I'm told, I never saw it). The problem is I'm not a programmer and wouldnt even know where to start to look for syntax errors.
can you post your sql statement?
try giving ASPNET user Write permissions to your database
did you make sure your database is not readonly?
Do you know if there is a Web.config file included in the website directory.  I'm wondering if there is any security impersonation settings in there.  That would allow the web user to impersonate a windows user who might not have write access to the database file.  Basically, somehow I think the web application does not have any write permissions.

Out of curiosity, do you see a corresponding .ldb file in the directory?
Yes, the database is not read only. The db folder it is in is not read only. Could it be permissions within the access database? I am logging in to the CMS to update it with tempadmin and in access it says the database owner is admin. Do you think this could be relevant?
There is a webconfig file but inside it is listed to forms for authentication under this section, would we need to somehow create an account for that user to have access since its not a windows account?

("Forms" You provide a custom form (Web page) for users to enter their credentials, and then you authenticate them in your application. A user credential token is stored in a cookie.
Do you happen to have Access on the machine or anywhere else?  You should try to open it and see if it has become corrupted or if there is a password to get in.  
We are able to open it up in access. It does not have any queries listed in it. Should there be queries listed?
Yes...  I have that forms authorization.

Maybe you should try this under the System.Web section.

<identity impersonate="true" userName="Domain\User" password="password"/>

This will log it in as a windows user.  Give that windows user full access.
No... the query is being added in the commandtext object in the code.
Below is the code that is in System.Web. is that line where it should be?


<authentication mode="Forms">
            <forms name=".TempLogin"
                  path="/" />
                  <credentials passwordFormat="SHA1" >
                        <user name="tempadmin"
                        password="052F8FED9B6E4CF1BDFE278550DF85ABF84AB226" />

            <identity impersonate="true" userName="NXPLUSNET\tempadmin" password="password"/>

          This section sets the authorization policies of the application. You can allow or deny access
          to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
          (unauthenticated) users.
anywhere in the <System.Web> is fine...
That should set the login for the thread the application is running on...   so if that user has access to EVERYTHING, so should the application.  We hope!
Make sure you have PRIMARY keys defined in each table. Was it converted from old format or maybe imported to Access?
Avatar of Sammy
Flag of Canada image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Aki4u - The database was copied from one 2003 server to another so the database should not have changed.
sammy1971 - I gave Network Service read/write access to the whole directory and still same issue
Should be Read/Write and Modify. Updating is modifying the records
make sure the parent directory has the same permissions as well
It has read/write/modify I apologize.  I am still getting the same error.  I have enabled it from the root on down just to see.
Can you please post your UPDATE query?
hmmmm.... I'll have to find it.  I am not a programmer.  I am the network admin.  They had thier site designed by a company that went out of business so we are trying to help them get their CMS working for them to upload settings.  Where would it be, I'll start browing to see what directory it might be located in.
I found a file named project-edit.aspx would the update query be in there?  Any text I can look for to help find it in the file?
one small thing...did you give access to NXPLUSNET\tempadmin user(read/write etc) ?
<form id="Form1" onsubmit="return ProcessFrame()" method="post" encType="multipart/form-data"
                  <table cellSpacing="0" cellPadding="0" width="100%" border="0">
                              <td id="navadmin" vAlign="top"><uc1:nav id="Nav1" runat="server"></uc1:nav></td>
                              <td id="content" vAlign="top">
                                    <p class="head">Edit Existing Project</p>
                                    <asp:panel id="pnlForm" runat="server">
aki4u.... I did when and it did not seem to help
Does the runat=sever mean anything that might help?
no, in this case it doesn't mean anything.
most likely they used 'UPDATE' statement somewhere in the code (it can be .cs file or .aspx).
did you try to open mdb file and see that each table has PRIMARY key?
<form id="Form1" method="post" runat="server">
                  <table cellSpacing="0" cellPadding="0" width="100%" border="0">
                              <td id="navadmin" vAlign="top"><uc1:nav id="Nav1" runat="server"></uc1:nav></td>
                              <td id="content" vAlign="top">
                                    <p class="head">Projects In Progress</p>
                                    <p><strong>Add New&nbsp;Project In Progress</strong></p>
                                    <p>Project Name<br>
                                          <asp:textbox id="txtNew" runat="server" MaxLength="250" Columns="55" EnableViewState="False"></asp:textbox>&nbsp;<asp:button id="btnAdd" runat="server" Text="Add" CommandName="txt_Add"></asp:button><br>
                                          <asp:requiredfieldvalidator id="rfvAdd" runat="server" ErrorMessage="A project name is required." ControlToValidate="txtNew"></asp:requiredfieldvalidator></p>
                                    <p><strong> Current&nbsp;Projects In Progress</strong></p>
                                    <asp:datagrid id="dgInProgress" runat="server" datakeyfield="InProgressID" cellpadding="4" gridlines="Horizontal"
                                          autogeneratecolumns="False" OnDeleteCommand="dg_Delete" OnUpdateCommand="dg_Update" OnCancelCommand="dg_Cancel"
                                          OnEditCommand="dg_Edit" showheader="False">
                                                <asp:editcommandcolumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:editcommandcolumn>
                                                            <%# Container.DataItem("InProgress") %>
                                                            <asp:textbox ID="txtInProgress" Runat="server" Text='<%# Container.DataItem("InProgress") %>' />
                                                            <asp:requiredfieldvalidator ID="rfvInProgress" Display="Dynamic" ErrorMessage="Project name is required." ControlToValidate="txtInProgress"
                                                                  Runat="server" />
                                                <asp:buttoncolumn Text="Delete" CommandName="Delete"></asp:buttoncolumn>
thats all I could find with update in it.  Its a pretty small website.... so there wasn't many files to go through.
When you browse to that page, can you see the content? Are any projects displayed?
do you have access to .mdb file?
the data is displayed on the site ok that is already in the database, it just cna't be updated.  I do have access to the database

I went to a differnet portion of the site to try to use different features of the site and when I try to edit a larger table of the database I get this error:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: The compiler failed with error code 1.

The box gives me the following plus some other info about system directories:

vbc : Command line error BC2010 : compilation failed : 'The paging file is too small for this operation to complete. '
please open the mdb file and see that each table has PRIMARY key (you must see yellow key icon indicator, usually it's a first field in table)?
K, the server didn't have access installed but I copied it to my harddrive and opened it up and checked out that each one had a primary key and they do.
Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The only ASP.NET user was a ASP.NET machine account, I added tihs with the proper permissions and I still have the same error.

should I readd that line to the webconfig file to see if it will fix the permissions (with a valid user account, just using the below example to show you what I meant:

<identity impersonate="true" userName="Domain\User" password="password"/>
I didn't know you took it out...yes try again. You may want to run iisreset on the server as well.
I figured it out.  I was googling around but I never would have without your guys help letting me know it was permisisons.  

The fix was that I had to look at the service that was running (w3wp.exe)  and give the permissions to that user. In my case it was IWAM_plesk(default)  exactly like that with the (default) added to it.  Usually apparently is Network Service but in this case it was under that username for the VPS.  It now works great.