Click here to Skip to main content
12,501,683 members (58,869 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
I have deployed an application and it support only DQL query but when I try to run DML query like insert/delete/update then it is throwing error:

Operation must use an updateble query

I think the database is read-only.

But I have checked read-only property of database file, but it is also false, still it is not working and same error.
Posted 19-Jun-12 2:42am
Comments
Shahin Khorshidnia 19-Jun-12 8:50am
   
Check the table maybe it's a View

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I see a couple possible issues right off the bat. First, does the account that is connecting to SQL have rights to that particular table? You can either implicitly or explicitly deny a user the ability to write to a table or a database.

Another possibility would be that the item you are writing to is not updatable. Shahin mentioned that it might be a View.

A third option would be that the way you are opening the connection to the database makes it read-only.

Fourth, the database might be rejecting your changes because it violates a set rule (referential integrity, a trigger, etc.) You might want to check to be sure you can run the script in SSMS (if you are using SQL) to be sure the script itself will work.

Fifth, you might be trying to update a query that contains a join. For instance, if you are joining two tables together and then trying to update both sets of table data, you will get an error. In Access, you will get an error even if you only update one table's worth of data.

Finally, if you are using a database like Microsoft Access, your user might not have rights to modify/create a file in the particular folder where the database is located. Don't forget that Access creates an LDF file when writes are being made (thus a file modify operation and a file create operation and later a file delete operation when the LDF is removed).

Here are some articles that might help:

http://www.mikesdotnetting.com/Article/74/Solving-the-Operation-Must-Use-An-Updateable-Query-error[^]

http://support.microsoft.com/kb/175168[^]

http://stackoverflow.com/questions/170578/operation-must-use-an-updatable-query-error-3073-microsoft-access[^]
  Permalink  
Comments
Surendra Tarai 20-Jun-12 6:52am
   
hello friend I am using ms access database datbase.mdb file
with oledbconnection
Tim Corey 20-Jun-12 8:20am
   
Then most of this information applies to you. Check your read/write permission on the drive, check to be sure you don't have a join, check to be sure you aren't writing to a query, and follow the other advice on the links I posted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 19 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100