asp 500 http error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seanh
    New Member
    • Sep 2007
    • 28

    asp 500 http error

    Hello,
    Could anyone help me, I keep getting a 500 HTTP error when I try to add a new record from my form.html. I have no idea where the error is. any suggestion is more than welcome. Thank you in advance.


    Code:
    ****Insert.asp****
    <%
    Dim objConn
    Dim objRS
    Dim SQL
    
    Set objConn = Server.CreateObject("ADODB.Connection")
    Set objRS = Server.CreateObject("ADODB.Recordset")
    
    objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\db\Data.mdb")
    SQL= "SELECT first, Last, middle FROM DataTable;"
    
    objRS.CursorType = 2
    objRS.LockType = 3
    
    objRS.Open SQL, objConn   
    
    objRS.AddNew
    objRS.Fields("first") = Request.Form("first")
    objRS.Fields("Last") = Request.Form("Last")
    objRS.Fields("middle") = Request.Form("middle")
    
    objRS.Update  
    objRS.Close
    Set objRS = Nothing
    Set objConn = Nothing
    %>

    Code:
     ***** Form.html****
    <html><head><title></title></head>
    <body>
    <form name="form" method="post" action="Insert.asp">
    first: <input type="text" name="first"> <br>
    Last:  <input type="text" name="Last"> <br>
    middle: <input type="text" name="middle"> <br>
    <input type="submit" name="Save" value="Submit">
    </form>
    </body>
    </html>
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi seanh,

    Have you got friendly error messages turned on? In Internet Exporer (or whatever browser you're using) if you go to <Tools> <Internet Options> <Advanced> is 'Show friendly http error messages' unchecked?

    If not then uncheck it, apply and run your page again - it should give you a bit more detail about your error which you can post here.

    Let me know how it goes,

    Dr B

    Comment

    • seanh
      New Member
      • Sep 2007
      • 28

      #3
      Hi DrBunchman,

      Thank you so much for responding.

      I had the http error checked, when I unchecked it IE gave me this error:

      Microsoft OLE DB Provider for ODBC Drivers error '80004005'
      [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x4f0 Thread 0x46d4 DBC 0x197d004 Jet'.

      /Insert.asp, line 10

      I think is this:
      objConn.Open "DRIVER={Micros oft Access Driver (*.mdb)}; DBQ=" & Server.MapPath( "\db\Data.m db")

      but I haven't a clue on how to fix it. Any suggestions are truly appreciated,
      Thank you for your help.
      -sean

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        This error indicates a permission problem accessing the database. Have you been able to successfully access this database in the past?

        Antivirus software and firewalls can also cause this error - have you recently installed or updated either of these on the server?

        Dr B

        Comment

        • seanh
          New Member
          • Sep 2007
          • 28

          #5
          Hi DR.B,

          I accidently gave you the wrong error, line and message.

          The error is in line 22 -- objRS.Update
          the IE error message is:
          Microsoft OLE DB Provider for ODBC Drivers error '80004005'
          [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.

          So sorry to have given you the wrong error message. Thank you so much for helping me out.
          -sean

          Comment

          • DrBunchman
            Recognized Expert Contributor
            • Jan 2008
            • 979

            #6
            No problem Sean,

            Is this database file currently open in Design Mode in Access? If so then exit it out of that and give it another try.

            Otherwise you need to check the security settings on your .mdb file and it's parent directory. What you need to look for depends on the security settings you are using for your website - are you using anonymous access or windows authentication?

            Dr B

            Comment

            • seanh
              New Member
              • Sep 2007
              • 28

              #7
              Hi Dr.B,

              Where could I check the security settings for the .mdb, on the server the database is require to have it in the \db\yourdatabas e.mbd folder but the server FAQs say that I am suppose to give it write access in the code but as much as I have tried I am unable to open the connection correctly and so far this is what I have:
              Code:
              <%
              Dim objConn
              Dim objRS
              Dim SQL
               
              Set objConn = Server.CreateObject("ADODB.Connection")
              Set objRS = Server.CreateObject("ADODB.Recordset")
              
              objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\db\Data.mdb")
              SQL= "SELECT first, Last, middle FROM DataTable;"
               
              objRS.CursorType = 2
              objRS.LockType = 3
               
              objRS.Open SQL, objConn   
               
              objRS.AddNew
              objRS.Fields("first") = Request.Form("first")
              ....
              objRS.Update (where I have the error)
              objRS.Close
              Set objRS = Nothing
              Set objConn = Nothing
              %>
              I am using FTP but its not anonymous. I also inserted data in the DB table to make sure it exist in the \db\ folder and I am able to view it when I call it but I'm just unable to write or add data to my Data.mdb.

              Once again thank you so much for help.

              -sean

              Comment

              • DrBunchman
                Recognized Expert Contributor
                • Jan 2008
                • 979

                #8
                If you right click on the database and select <Properties><Se curity> you should get a list of users and their permission levels. Find the Internet Guest Account IUSR_<COMPUTERN AME> and make sure it has read and write permissions.

                Let me know how it goes.

                Dr B

                Comment

                • seanh
                  New Member
                  • Sep 2007
                  • 28

                  #9
                  Hi Dr B!

                  WOW!!!
                  Thank you so much for your response and patience to all my questions. It took me a while to figure out where this was but I finally GOT IT! Now its working and I could not have done it with out your help. Thank you so very much for sharing your knowledge with newbies like me. I truly am very greatful.

                  -Sean.

                  Comment

                  • DrBunchman
                    Recognized Expert Contributor
                    • Jan 2008
                    • 979

                    #10
                    Good work Sean! Glad I could help you out.

                    Dr B

                    Comment

                    Working...