Click here to Skip to main content
14,427,367 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hiiii to all i have completed my windows application. I created the setup of my project but when its setup runs,it shows an error in my first form.Actually i am using acess2003 database as a local database. and uses the following connection string
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/Furniture.mdb");

i m using windows7 as OS and my system is 32bit system. it show me the error
Operation must use an updateable query
i search a lot and change the security setting of database file but still it shows the same prblm... plz help
Posted
Updated 17-Aug-12 21:42pm
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

One quite likely reason is that the user running the program doesn't have read-write access to the database file, especially if it is located in program files folder.

So check the directory and file permissions and moodify them if needed. You can also consider changing the location of the database file to another, more asily accessible folder.
   
Comments
Espen Harlinn 19-Aug-12 8:31am
   
Good point :-D
Wendelius 21-Aug-12 1:06am
   
Thanks :)
Rate this:
Please Sign up or sign in to vote.

Solution 1

When a Jet 4.0 database (the actual type of database represented by your "Access" mdb file) is deployed in a multi-user environment, an .ldb file is created whenever the database is opened. The .ldb file contains details which include who has opened the file, and primarily serves to prevent opened records being written to by another user.
In the context of an ASP.NET application, who the "user" is will depend on the platform: for XP Pro machines, the user is the ASPNET account. On Windows Server 2003, 2008 and Vista, it is the NETWORK SERVICE account. However, if you have ASP.NET Impersonation enabled, the default user account will be IUSR_machinename, or whichever account you have applied. If you are unsure which account your ASP.NET application is running under, Environment.UserName will return it. To be able to create, write to and delete the required .ldb file, the relevant user needs MODIFY permissions on the folder that the .mdb file is in.
To set this permission, right click on the App_Data folder (or whichever other folder you have put the mdb file in) and select Properties. Look for the Security tab. If you can't see it, you need to go to My Computer, then click Tools and choose Folder Options.... then click the View tab. Scroll to the bottom and uncheck "Use simple file sharing (recommended)". Back to the Security tab, you need to add the relevant account to the Group or User Names box. Click Add.... then click Advanced, then Find Now. The appropriate account should be listed. Double click it to add it to the Group or User Names box, then check the Modify option in the permissions. That's it. You are done.
   
Comments
Member 8233601 18-Aug-12 4:15am
   
sir i have put my mdb file in debug folder and i am using windows7 which is currently out of service. now plz help me out through each step o solve this prblm..
Rate this:
Please Sign up or sign in to vote.

Solution 5

Solving the Operation Must Use An Updateable Query error


The unbelievably cryptic Operation Must Use An Updateable Query error is the bane of developers who are just starting out with Access and ASP.NET. You've done your code, plopped your database file in the App_Data folder (or at least, you should have done), and try to run a page that INSERTs or UPDATEs records, and it all stops dead. This brief article explains the cause of the error, and the steps required to stop it recurring.



When a Jet 4.0 database (the actual type of database represented by your "Access" mdb file) is deployed in a multi-user environment, an .ldb file is created whenever the database is opened. The .ldb file contains details which include who has opened the file, and primarily serves to prevent opened records being written to by another user.

In the context of an ASP.NET application, who the "user" is will depend on the platform: for XP Pro machines, the user is the ASPNET account. On Windows Server 2003, 2008 and Vista, it is the NETWORK SERVICE account. However, if you have ASP.NET Impersonation enabled, the default user account will be IUSR_machinename, or whichever account you have applied. If you are unsure which account your ASP.NET application is running under, Environment.UserName will return it. To be able to create, write to and delete the required .ldb file, the relevant user needs MODIFY permissions on the folder that the .mdb file is in.

To set this permission, right click on the App_Data folder (or whichever other folder you have put the mdb file in) and select Properties. Look for the Security tab. If you can't see it, you need to go to My Computer, then click Tools and choose Folder Options.... then click the View tab. Scroll to the bottom and uncheck "Use simple file sharing (recommended)". Back to the Security tab, you need to add the relevant account to the Group or User Names box. Click Add.... then click Advanced, then Find Now. The appropriate account should be listed. Double click it to add it to the Group or User Names box, then check the Modify option in the permissions. That's it. You are done.

Note: this fix will also solve "The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data" errors.



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


2nd source:
http://www.infolet.org/2013/06/fix-ms-access-operation-must-use-an-updateable-query-problem-error.html[^]
   
v2

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




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