Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. update Access DB

update Access DB

Scheduled Pinned Locked Moved Web Development
databasecomsysadminhelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leezardd
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • L leezardd

      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

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      Check that the account used by IIS has write access on the directory where the MDB file is.

      L 1 Reply Last reply
      0
      • H Hesham Amin

        Check that the account used by IIS has write access on the directory where the MDB file is.

        L Offline
        L Offline
        leezardd
        wrote on last edited by
        #3

        Your "write access" tip led me in the right direction. Turns out "users" did not have write permission to one of the folders in the path to the database. Thanks a bunch!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups