update Access DB
-
When I try to run an update query via ASP to an Access DB, I get the error below. The insert query works fine when I run it from Access, but not ASP. I can read from the DB fine, but can't write to it. Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. /Tutorial/guestbook.asp, line 43 Code: <% @Language=VBScript %> Guest Book <% IF request.form ("Message")="True" THEN strTB1=request.form("To") strTB2=request.form("EMailAdd") strTB3=request.form("CC") strTB4=request.form("Subject") strMB1=request.form("Memo") IF strMB1 = "" THEN iLenMB1=255 ELSE iLenMB1 = Len(strMB1) END IF 'Connects to the Access driver and Access database in the Inetpub 'directory where the database is saved strProvider = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\Wwwroot\Tutorial\guestbook.mdb;" 'Creates an instance of an Active Server component set objConn = server.createobject("ADODB.Connection") 'Opens the connection to the data store objConn.Open strProvider 'Instantiate Command object and use ActiveConnection property to 'attach connection to Command object set cm = Server.CreateObject("ADODB.Command") cm.ActiveConnection = objConn 'Define SQL query cm.CommandText ="INSERT INTO Guestbook (TB1,TB2,TB3,TB4,MB1) VALUES (?,?,?,?,?)" 'Define query parameter configuration information for guestbook fields set objparam=cm.createparameter(, 200, , 255, strTB1) cm.parameters.append objparam set objparam=cm.createparameter(, 200, , 255, strTB2) cm.parameters.append objparam set objparam=cm.createparameter(, 200, , 255, strTB3) cm.parameters.append objparam set objparam=cm.createparameter(, 200, , 255, strTB4) cm.parameters.append objparam set objparam=cm.createparameter(, 201, , iLenMB1, strMB1) cm.parameters.append objparam cm.execute response.write("Thank you!") ELSE%>
Guestbook
To
Email Address
CC
Subject
Message
<%En
-
When I try to run an update query via ASP to an Access DB, I get the error below. The insert query works fine when I run it from Access, but not ASP. I can read from the DB fine, but can't write to it. Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. /Tutorial/guestbook.asp, line 43 Code: <% @Language=VBScript %> Guest Book <% IF request.form ("Message")="True" THEN strTB1=request.form("To") strTB2=request.form("EMailAdd") strTB3=request.form("CC") strTB4=request.form("Subject") strMB1=request.form("Memo") IF strMB1 = "" THEN iLenMB1=255 ELSE iLenMB1 = Len(strMB1) END IF 'Connects to the Access driver and Access database in the Inetpub 'directory where the database is saved strProvider = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\Wwwroot\Tutorial\guestbook.mdb;" 'Creates an instance of an Active Server component set objConn = server.createobject("ADODB.Connection") 'Opens the connection to the data store objConn.Open strProvider 'Instantiate Command object and use ActiveConnection property to 'attach connection to Command object set cm = Server.CreateObject("ADODB.Command") cm.ActiveConnection = objConn 'Define SQL query cm.CommandText ="INSERT INTO Guestbook (TB1,TB2,TB3,TB4,MB1) VALUES (?,?,?,?,?)" 'Define query parameter configuration information for guestbook fields set objparam=cm.createparameter(, 200, , 255, strTB1) cm.parameters.append objparam set objparam=cm.createparameter(, 200, , 255, strTB2) cm.parameters.append objparam set objparam=cm.createparameter(, 200, , 255, strTB3) cm.parameters.append objparam set objparam=cm.createparameter(, 200, , 255, strTB4) cm.parameters.append objparam set objparam=cm.createparameter(, 201, , iLenMB1, strMB1) cm.parameters.append objparam cm.execute response.write("Thank you!") ELSE%>
Guestbook
To
Email Address
CC
Subject
Message
<%En
Check that the account used by IIS has write access on the directory where the MDB file is.
-
Check that the account used by IIS has write access on the directory where the MDB file is.