Get Updates to your Email

Error: The Operation must use an updatable query

0

Posted by Shyam | Posted in ASP.Net, Programming, Technology, Web, Windows | Posted on 09-06-2009

When we work with an ASP.Net application with MS-Access as backend database, we often face the error “The operation must use an updatable query”. Even though our code compiles and builds without any errors, when we run the application, when the page tries to INSERT or UPDATE records the above error will be raised. We’ll see the details of the error root cause and the easy solution.

When working with MS-Access database in ASP.Net web application, the MS-Access database.mdb file will be placed in the App_Data folder. When we develop ASP.Net application in multi-user environment(like Windows XP, Windows 2003, Windows 2008), a.ldb file will be created whenever the database is opened. This particular .ldb file contains details of the user who opened the file, and prevents writing the records which are opened by another user.

All ASP.Net applications use the “ASPNET” machine account in Windows XP and “NETWORK SERVICE” account in Windows Server 2003, 2008 and Vista machines to access the file system of Operating System. Inorder to create, write and delete the required .ldb file, the relevant user “ASPNET” or “NETWORK SERVICE” account must needs MODIFY / WRITE permissions on the folder where the .mdb file resides which is App_Data folder in our ASP.Net Application.

To enable MODIFY / WRITE permissions on the App_Data folder, open the ASP.Net web application project folder in Windows Explorer, right click on the App_Data folder and select properties. When we reach properties we can see several tabs, among the tabs, go to Security tab which contains User Names section as shown below.

click the Edit button which will show UserNames window as shown below.

and then click Add which shows as follows

Type the account and click “Check Names” to verify the account name typed and click “OK” to add the user account. Upon clicking add, we’ll reach to Security Permission Edit Window, then click “Modify” for the account we added and click ok and Run the ASP.Net web application which can insert & update in the Microsoft Access Database.

The above solution can even fix the errors like 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.

You may also like to read

 

Get Updates to your Email

Loading
This entry was posted on Tuesday, June 9th, 2009 by Shyam and is filed under ASP.Net, Programming, Technology, Web, Windows. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Post a comment