Solving the Operation Must Use An Updateable Query error
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, simply Response.Write(Environment.Username) to get 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.
Currently rated 4.88 by 8 people
Rate Now!
Date Posted:
30 April 2008 22:48
Last Updated:
17 August 2009 08:40
Posted by:
Mikesdotnetting
Total Views to date:
8985
Printer Friendly Version
Comments
30 December 2008 06:46 from Mikesdotnetting
Hi Aaron,
The error is thrown by the underlying Jet Oledb provider, which doesn't know or care which language you are using. So long as you can identitfy the correct user account to apply the permissions to, you whould be able to resolve the issue.
27 February 2009 06:49 from Muraya
It worked but after restarting IIS in service.msc (Windows Xp)
29 April 2009 18:27 from Somnath Banerjee
hey buddy, thanx a lot. You solved my problem. THANK YOU again.
04 May 2009 16:52 from bhavesh
Thanks for giving this solution and I solve on my II but i can't understand how to solve on my web server please replay me on my email id how to solve this problem on my web server??
Thanks
04 May 2009 19:36 from Mikesdotnetting
@bhavesh
Follow the same steps as you did to solve it on the other machine.
08 May 2009 08:44 from matrostik
i am using Windows 7 and set permissions to NETWORK SERVICE account everything work ok but .ldb file is not created and if exception is throwing the .mdb file stay locked until i kill IIS Worker process
11 May 2009 07:08 from Mikesdotnetting
@Mastrostik
I believe that the user account in Windows 7 is IUSR_machinename. this is the one that need MODIFY permissions on the relevant folder.
29 May 2009 16:52 from Bill Westgarth
Thanks a million for the tip.
Like you said "unbelievably cryptic".
How on earth did you fathom it out?
Regards, Bill Westgarth.
30 May 2009 21:31 from Mikesdotnetting
@Bill
I can't take the credit for that. The error message is returned from the Jet provider, and that's been the case since way before I even started web development. When I first encountered the error message, someone in a Usenet news group gave me the answer. Since it's still a common question, I thought I'd put the full answer somewhere where I could reference it easily. Hence the article.
02 June 2009 10:29 from Trojan Horse
Another simple way in vista is: Run visual studio as "Administrator"(By right clicking on it)!! Thats it...
24 August 2009 22:29 from RK
Thanks a lot dude! I was breaking my head since morning to solve this problem. You helped me out in 2 mins! Thank you
04 September 2009 08:06 from Nagi
i coudnt find Security in folder property.i checked folder option also please help me to rectify the error
04 September 2009 23:15 from Mikesdotnetting
@Nagi
I can't add anything more than I have already covered in the article. Perhaps you should read it again. The answer is there.
21 November 2009 01:59 from Max
What an awesome little trick! Thanks! I usually do trial and error to get the write permissions.
03 March 2010 15:35 from Chris
One thing you should try if you can't see the security tab of file/folder properties is going to Tools-->Folder Options and looking on the View tab at the bottom of the list for "Use simple file sharing." Uncheck this option, apply changes, and check again.


30 December 2008 04:22 from Aaron
Hi Mike:
Thanks for this post. I'll give it a shot to see if it resolves a similar issue on our application running on Vista and accessing the data.mdb file. The app. is coded in C++ so hopefully your solution will work for us as well since nothing else has been effective thus far.
Regards,
Aaron