[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

Cannot write to MS Access database

I have written a web application in asp.. it was working fine on another server but when that crsahed, i moved it over to another server. I can read from the database but I can't write to it. The database is an MS Acess database. I'm using System DSN.


The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button, or try again later.

Open the 192.168.0.102:8080 home page, and then look for links to the information you want.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/Employee_Update.asp, line 50


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Page:
GET /Employee_Update.asp

Time:
Thursday, August 02, 2007, 11:32:17 PM


More information:
Microsoft Support
 
0
alateos
Asked:
alateos
  • 7
  • 3
  • 3
  • +2
1 Solution
 
bugs021997Commented:
@alateos

Frankly its hard to assume what your doing in the code thats causing the error as you haven't posted the line where this error occurs.

But from the error description one can assume that this occurs on a page when an event is updating or inserting into a recordset.

Solution

There are several things that may cause this ODBC error. Many of the possible reasons are listed in the table below.

> The permissions that are set on the directory the database is in. IUSR privileges must be set to "read/write".  

>The permissions on the database itself do not have full read/write privileges in effect.



I guess its the IUSR_MACHINENAME Privileges that you need to set on the folder containing the database and everything should be smooth...


Cheers
^_^
BUGS
0
 
bugs021997Commented:
@alateos

This is almost always a permissions issue. Be sure that the MDB file is in a folder where IUSR_<machineName> and IWAM_<machineName> have read/write access (because the anonymous user needs to create an .LDB file when modifying the database).

If you are using Windows Authentication, make sure all authenticated users belong to a group that has read/write permissions on the folder where the database exists, and if you can't use a group, step through each user and check that they have sufficient privileges.

Cheers
^_^
BUGS
0
 
Dirar Abu KteishCommented:
check this article from microsoft

http://support.microsoft.com/kb/175168

-dirar
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
alateosAuthor Commented:
I tried to do play around with permissions... but my version of Windows XP Pro doesn't have permissions.. can you help?
0
 
alateosAuthor Commented:
Actually I just found another thing... The folder in which the database is in is Read-only... I keep unchecking and applying and it comes back to being read-only... could this be the problem?
0
 
RipinCommented:
That error occurs when query can't update database.
MDB file is locked or read-only.

It can be locked if in asp page you haven't set object state to nothing and close connection.
Like...
Set Conn = nothing
Conn.Close

What kind of a server do you have if there isn't user rights?
IIS must have (IUSR_Machinename) enouf rights for that folder and mdb file.

0
 
alateosAuthor Commented:
Well here's the thing... this same asp code used to reside on another server and was working fine. I don't know how to give IUSR_... rights since I don't see the permissions tab anywhere.
0
 
bugs021997Commented:
Try..

Right-click the virtual directory where you copied the database and then click Properties.
Click the Virtual Directory tab.
Under Execute Permissions, click Scripts and Executables, and then click OK.
0
 
alateosAuthor Commented:
I did that... still doesn't work
0
 
alateosAuthor Commented:
I even put the database in the root c:\ path. It's still giving me the same error. Here's page of my source code thats' giving the problem.

<%
'If the session variable is False or does not exsist then redirect the user to the unauthorised user page
If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) = True then
      
      'Redirect to unathorised user page
      Response.Redirect"unauthorised_user_page.htm"
End If
%>
<%       if (request.QueryString("action") = "Add") then %>
      <!-- #include File="Employee_create.asp" -->
<%      Else
             if (request.QueryString("action") = "Delete") then %>
            <!-- #include File="Employee_delete.asp" -->
<%            Else %>
                  <html>
                        <head>
                              <LINK REL="STYLESHEET" TYPE="text/css" HREF="Style/TestIE.css" />
                              <title>Taverna-Update Employee</title>
                        </head>

                  <body>

                  <%
                        If (not IsNull(request.QueryString("EmployeeToUpdate")) and request.QueryString("EmployeeToUpdate") <> "") then
                              display_type="ForUpdate"
                  %>
                              <!-- #include File="Get_EmployeeDetail.asp" -->

                  <%      Else

                              EmpID = request.QueryString("EmpID")
                              First_Name = request.QueryString("First_Name")
                              Last_Name = request.QueryString("Last_Name")
                              Home_Phone = request.QueryString("Home_Phone")
                              Cell_Phone = request.QueryString("Cell_Phone")
                              Rating = request.QueryString("Rating")
                              Title = request.QueryString("Title")
                              Issues = request.QueryString("Issues")

                              Set conn = Server.CreateObject("ADODB.Connection")
                              
                              Conn.Open("Taverna")

                              sql = "update Employee set First_Name = '" & First_Name & "', Last_Name = '" & Last_Name & _
                                                      "', Home_Phone='" & Home_Phone & _
                                                      "', Cell_Phone='" & Cell_Phone & _
                                                      "', Rating='" & Rating & _
                                                      "', Title='" & Title & _
                                                      "', Issues='" & Issues & "' where EmpID = " & EmpID
                              conn.execute(sql)
                              conn.close
                  %>
                              <FORM "Employee_UPDATE" method="Get" action="Employee_List.asp">
                              <TABLE WIDTH="100%" HEIGHT="100%" BORDER="0">
                                    <TR VALIGN="middle" ALIGN="center">
                                          <TD CLASS="IEBigText" ALIGN="Center">Employee Information Successfully Updated</TD>
                                    </TR>
                                    <TR ALIGN="CENTER">
                                          <TD ALIGN="CENTER"><input  CLASS="IENaviBtn" type="submit" value="View Employee List"></TD>
                                    <TR>
                              </TABLE>
                              <FORM>
                  <%
                        End If
                  %>

                  </body>
                  </html>
            <% End If %>
<% End If %>
0
 
kevp75Commented:
right click the folder that the database resides in.

Click the security tab.  Once there you should see a list of users that have access to that folder.

Click add.

There should be a search where you can type in IUSR....hit find

then hit add

once that user is in the list, select it, then check off read/write/modify.   hit apply, then hit ok
0
 
alateosAuthor Commented:
First of all.. there is no security tab. Second, I'm now connecting directly to the Access database in the root directory of the c:\ drive.
0
 
kevp75Commented:
ok.   that is a very bad idea.  the IUSR account needs to have read/write/modify access to the folder that the database is in, and to put it in the root of a drive is not a good idea...

You need to shut off "simple file sharing". Form this article,
http://www.aspfaq.com/show.asp?id=2205, this is the relevant paragraph:

Now, what if you don't have a Security tab?

Open up Windows Explorer, open the Tools menu, choose Folder Options, and go
to the View tab. The last item in the list is called "Use simple file
sharing." Uncheck this box, click Apply and OK, and try the above steps
again

After shutting off "simple file sharing", navigate to the folder
containing the database, then, from that same article:

In Windows Explorer, right-click the folder in question, hit Properties, and
select the Security tab. If the Internet Guest Account (IUSR_<machinename>)
is not listed, click the Add... button and type IUSR_<machine_name> into the
textbox, and click OK. Now select the Internet Guest Account, and check that
the permissions are adequate. For most web applications, Read and Write is
sufficient. You may have to do this for individual files as well, and for
Access databases specifically, you might also have to open up the temp
folder. You can see Article #2039 for more detailed instructions and setting
up permissions for IUSR.


p.s.      there is nothing wrong with your code.
0
 
alateosAuthor Commented:
kevp75... you just freakin made my day!!!
0
 
kevp75Commented:
;)
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 7
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now