Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    89
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Database connection error

    Hi All,

    I'm having a bit of a problem inserting some info into a database. Heres my code:

    <%
    dim strFirst
    dim strEmail

    strFirst = Request.Form("name")
    strEmail = Request.Form("email")

    Response.Write(strFirst) & "<br>"
    Response.Write(strEmail)


    MyPath=Server.MapPath("emails_names.mdb")
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & MyPath

    SQL = "INSERT INTO details (Name, Email) VALUES ('"&strFirst&"','"&strEmail&"')"
    conn.Execute(SQL)
    %>


    and heres the error message:

    "Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
    /flash_capture/project3/processForm.asp, line 21"


    Line 21 is conn.Execute(SQL). I'm fairly new to asp so I apologise if the error is blindingly obvious.

    Thanks

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    I just tested with a small Access database with a table named details and your code worked just fine. Maybe you're using a query (SQL string) with joins and the query isn't updateable or something.

    But here is a related link:

    Why do I get database-related 80004005 errors?
    http://www.aspfaq.com/show.asp?id=2009
    <<
    Microsoft OLE DB Provider for ODBC Drivers error '80004005'
    [Microsoft][ODBC Microsoft Access 97 Driver] Operation must use an updateable query.
    This is almost always a permissions issue, where IUSR_machineName or the autheticated user doesn't have read or write access to the MDB file, the folder in which it is located, or the TEMP/TMP folders.
    >>

    So I'd see about adding some permissions to the folder the database resides in.

    And for a connection string that's supposed to be a little more robust:

    http://www.carlprothman.net/Default....orMicrosoftJet
    Last edited by Bullschmidt; 09-14-2005 at 03:20 AM.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


  •  

    Posting Permissions

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