Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to insert into Access Database

Status
Not open for further replies.

Albuckj2

Programmer
Jan 7, 2003
68
GB

I cannot insert data into my access database that resides on my own PC (I'm using IIS as a local server, Win XP).

The error I get is the following:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/stocks/register_check.asp, line 60

I have read that this might be something to do with permissions, but how can I effect the permissions??? My code is listed below. Thanks for any help in advance.


dim username, password, email, surname, first_name, organisation

username = Request.Form("username")
password = Request.Form("password")
email = Request.Form("email")
surname = Request.Form("surname")
first_name = Request.Form("first_name")
organisation = Request.Form("organisation")

dim objConn, strConnection
set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "DSN=TestConny"
objConn.Open strConnection

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Set Recordset1.ActiveConnection = objConn

Recordset1.Open strQ, objConn

sql = "INSERT into Users (Username, Password, Email, Surname, First_name, Organisation) VALUES ('" & username & "', '" & password & "', '" & email & "', '" & surname & "', '" & first_name & "', '" & organisation & "')"

objConn.Execute sql
 
Just give the directory that contains the db write permisions...
 
Try changing your connection string to:

Code:
strConnection = "DSN=testconny;UID=admin;PWD="
--James
 
robj2 => I tried what you said, it didn't work
JamesLean => I tried what you said, it didn't work

I also looked at the link, it gave 4 possible causes for the error. I've ruled out 3 of them, and the other is the most common but I don't know how to check it. Does anyone know anything about an Internet Guest Account and how I can change it? I looked in tools => internet options => security tag, but saw nothing about an Internet Guest Account. Any ideas...???




The most common reason is that the Internet Guest account (IUSR_MACHINE), which is by default part of the "Everyone" group, does not have Write permissions on the database file (.mdb). To fix this problem, use the Security tab in Explorer to adjust the properties for this file so that the Internet Guest account has the correct permissions.

NOTE: When using Microsoft Access databases with ADO, it is also necessary to give the Internet Guest account Write permissions on the directory containing the .mdb file. This is because Jet creates an .ldb file to handle database locking. You may also need to give read/write permission on the "Temp" folder because Jet may create temporary files in this directory.
 
IIS uses a local user account called IUSR_<machinename>to access files if it needs to. You need to check the permissions on the mdb file and the folder where it resides and make sure that user account has read/write access to both. --James
 
Thanks JamesLean, that done the trick. It was in the IIS settings. Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top