Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    8

    Angry Unanswered: Cant update Access DB using ASP

    Hi Everybody,

    I have a problem: when i want to use the rs.update method in ASP, i get the following error:

    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Microsoft Access Driver] Update not possible; Database or Object ist write protected.
    /hcb/anmelden_response.asp, line 42

    can somebody help me ? (I am using Windows XP)


    the code:

    ---- CODE START ----

    <%

    'Dimension variables
    Dim adoCon 'Holds the Database Connection Object
    Dim rs 'Holds the recordset for the records in the database
    Dim strSQL 'Holds the SQL query to query the database

    'Create an ADO connection object
    Set adoCon = Server.CreateObject("ADODB.Connection")

    adoCon.Mode = 3
    'adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/db/hcb.mdb")
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/db/HCB.mdb")
    'adoCon.Open "DSN=HCB"

    'Create an ADO recordset object
    Set rs = Server.CreateObject("ADODB.Recordset")

    'Initialise the strSQL variable with an SQL statement to query the database
    strSQL = "Web_Formular"

    'Set the cursor type we are using so we can navigate through the recordset
    rs.CursorType = 2 '2

    'Set the lock type so that the record is locked by ADO when it is updated
    rs.LockType = 3 '3

    'Open the recordset with the SQL query
    rs.Open strSQL, adoCon

    'Tell the recordset we are adding a new record to it
    rs.AddNew

    'Response.Write rs("Vorname")
    'Response.Write rs("Nachname")

    rs("Vorname") = Request.Form("VNAME")
    rs("Nachname") = Request.Form("NNAME")
    'rs.fields("Datum_Erfassung")=now

    'Write the updated recordset to the database
    rs.Update

    'Reset server objects
    rs.Close
    Set rs = Nothing
    Set adoCon = Nothing
    %>

    </body>
    </html>

    ---- CODE END ----

  2. #2
    Join Date
    Mar 2004
    Posts
    4
    Might be a bit obvious, but have you checked that you have write permissions?

  3. #3
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Yes through IIS (or perhaps a control panel if on a Web host) set the permissions for the virtual (Web) folder containing the database to be more than just read only.
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  4. #4
    Join Date
    Jul 2003
    Posts
    8

    Rights were the problem ...

    Thanks everybody ...

    the rights were the (stupid) problem ...

    boris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •