0

I'm new to ASP.NET and have a problem when I am trying make the website online. My website works wonderfully when I run the website in Visual Studio 2012.

I already put the website online so you can go and check: http://keowns.bebbosoft.co.za/

In the bottom left you will see Username, a textbox, and a add button.

when you type some text, the text in that add button adds a new record in a Access database.

as I said, this works when I debug, but when I put the website online, you will see this error in the content:

"Operation must use an updateable query."

the folder in the web server is set correctly(for the permissions):

enter image description here

what am I doing wrong?

Santosh Panda
  • 7,235
  • 8
  • 43
  • 56
Fred
  • 2,402
  • 4
  • 31
  • 58
  • what your link is giving me `Login Failed` error when i put something on textboxes and hit enter. – Rahul May 20 '13 at 13:07
  • yeah, thats login stuff. its working. the test phase login you can test as: Username - Frederik and Password - 123. – Fred May 20 '13 at 13:09
  • but the problem is on the bottom left, you will see another table which contains Username, a textbox, ans a ADD button. the add button is the one that actually adds data into the database... or attempts to do that. the table in the top just checks if that record exists in the database. – Fred May 20 '13 at 13:11
  • if i use the username and password mentioned by you then it is showing `Logged In`,,actually i m confused that what you want. – Rahul May 20 '13 at 13:11
  • dude.... in the bottom left corner of the page. not in the heading. – Fred May 20 '13 at 13:12
  • ok just check my answer and give permission .. – Rahul May 20 '13 at 13:14

4 Answers4

2

Check the permissions on the folder containing the access database, the access database and the folder it is in should be writable I believe.

see the following link for more information http://www.mikesdotnetting.com/Article/74/Solving-the-Operation-Must-Use-An-Updateable-Query-error

kolin
  • 2,326
  • 1
  • 28
  • 46
  • yes, I already checked that in my website control panel. permissions is correct for the access database file and the folder in which it is located. – Fred May 20 '13 at 13:14
  • If you checked that link, someone said it worked after restarting IIS. Can you try that? – codingbiz May 20 '13 at 13:18
  • How do I reset IIS when the web server is handling this? – Fred May 20 '13 at 13:22
  • also check out this link : http://blog.eriklane.com/post/2005/11/14/ASPNET-and-MS-Access-Operation-must-use-an-updatable-query.aspx, specifically point 1, maybe you could try that. It seems overwhelmingly that this is a permissions issue rather than anything else. – kolin May 20 '13 at 13:34
  • Reseting your webserver : I would imagine there will be an option which basically says "restart (or start/stop) website" – kolin May 20 '13 at 13:35
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 modify them if needed.

Sometimes permission issue get resolved by Restarting the server,,must try.

Check this link

Community
  • 1
  • 1
Rahul
  • 5,603
  • 6
  • 34
  • 57
  • the database file is located on the web server. and the folder permissions is set to read/write. – Fred May 20 '13 at 13:17
  • 1
    ok are you using `ODBC`., this problem comes because of many reason.but `permission` one is the major that's wwhy i am mentioning about this case. – Rahul May 20 '13 at 13:18
  • yes --> @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Server.MapPath("App_Data/ABSACapital.accdb") – Fred May 20 '13 at 13:21
  • Just restarted the server through the website control panel. Still getting that...... – Fred May 20 '13 at 13:27
  • It's file permissions, as said here - But Access create a temp lock file when it's in read / write mode so you need to make sure your application has write permissions to the whole `App_Code` folder – RemarkLima May 20 '13 at 13:52
1

Did you take a look at http://www.mikesdotnetting.com/Article/74/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."

anon
  • 11
  • 1
  • yes. and the thing is the folder is on the web server. I cant just right click and say security ect. this is all online. my problem is not when I run the website locally. its the moment when I put the website online under my hosting space. – Fred May 20 '13 at 13:30
0

Thank you guys for giving me some insight... but after struggelling and reading the links you gave me, I did that things but still it did not work. my fix is this: change the web.config file to look like this:

<configuration>
<system.web>
    <identity impersonate="true"/>
</system.web>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
<system.webServer>
</configuration>

thank you for all your help!

Fred
  • 2,402
  • 4
  • 31
  • 58