Avatar of networxplus
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
ASP.NET

Avatar of undefined
Last Comment
networxplus

8/22/2022 - Mon
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.
networxplus

ASKER
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?
rhencullen

Here's a link on ASPRunner, talking about debugging the Must use updatable query:

http://www.xlinesoft.com/asprunner/docs/troubleshooting__operation_must_use_an_updateable_query__errors.htm

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.

Paul
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
YZlat

there must be a syntax error in your query
pauljk1619

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.
pauljk1619

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.  
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
networxplus

ASKER
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.
YZlat

can you post your sql statement?
YZlat

try giving ASPNET user Write permissions to your database
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
YZlat

did you make sure your database is not readonly?
pauljk1619

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?
networxplus

ASKER
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?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
networxplus

ASKER
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.
pauljk1619

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.  
networxplus

ASKER
We are able to open it up in access. It does not have any queries listed in it. Should there be queries listed?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
pauljk1619

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.
pauljk1619

No... the query is being added in the commandtext object in the code.
networxplus

ASKER
Below is the code that is in System.Web. is that line where it should be?

___

<authentication mode="Forms">
            <forms name=".TempLogin"
                  loginUrl="admin/login.aspx"
                  protection="All"
                  timeout="80"
                  path="/" />
            <forms>
                  <credentials passwordFormat="SHA1" >
                        <user name="tempadmin"
                        password="052F8FED9B6E4CF1BDFE278550DF85ABF84AB226" />
                  </credentials>
            </forms>
      </authentication>

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





    <!--  AUTHORIZATION
          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.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
pauljk1619

anywhere in the <System.Web> is fine...
pauljk1619

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!
aki4u

Make sure you have PRIMARY keys defined in each table. Was it converted from old format or maybe imported to Access?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Sammy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
networxplus

ASKER
Aki4u - The database was copied from one 2003 server to another so the database should not have changed.
networxplus

ASKER
sammy1971 - I gave Network Service read/write access to the whole directory and still same issue
Sammy

Should be Read/Write and Modify. Updating is modifying the records
make sure the parent directory has the same permissions as well
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
networxplus

ASKER
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.
aki4u

Can you please post your UPDATE query?
networxplus

ASKER
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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
networxplus

ASKER
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?
aki4u

one small thing...did you give access to NXPLUSNET\tempadmin user(read/write etc) ?
networxplus

ASKER
<form id="Form1" onsubmit="return ProcessFrame()" method="post" encType="multipart/form-data"
                  runat="server">
                  <table cellSpacing="0" cellPadding="0" width="100%" border="0">
                        <tr>
                              <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">
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
networxplus

ASKER
aki4u.... I did when and it did not seem to help
networxplus

ASKER
Does the runat=sever mean anything that might help?
aki4u

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?
Your help has saved me hundreds of hours of internet surfing.
fblack61
networxplus

ASKER
<form id="Form1" method="post" runat="server">
                  <table cellSpacing="0" cellPadding="0" width="100%" border="0">
                        <tr>
                              <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">
                                          <columns>
                                                <asp:editcommandcolumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:editcommandcolumn>
                                                <asp:templatecolumn>
                                                      <itemtemplate>
                                                            <%# Container.DataItem("InProgress") %>
                                                      </itemtemplate>
                                                      <edititemtemplate>
                                                            <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" />
                                                      </edititemtemplate>
                                                </asp:templatecolumn>
                                                <asp:buttoncolumn Text="Delete" CommandName="Delete"></asp:buttoncolumn>
                                          </columns>
                                    </asp:datagrid></td>
                        </tr>
                  </table>
            </form>
networxplus

ASKER
thats all I could find with update in it.  Its a pretty small website.... so there wasn't many files to go through.
aki4u

When you browse to that page, can you see the content? Are any projects displayed?
do you have access to .mdb file?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
networxplus

ASKER
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

networxplus

ASKER
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. '
aki4u

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)?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
networxplus

ASKER
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.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
networxplus

ASKER
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"/>
aki4u

I didn't know you took it out...yes try again. You may want to run iisreset on the server as well.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
networxplus

ASKER
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.