Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
Shahin Khorshidnia 19-Jun-12 8:50am    
Check the table maybe it's a View

1 solution

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[^]
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900