locked
Microsoft Office 12.0 Access Database Engine OLE DB Provider-Delete and insert issue RRS feed

  • Question

  • User313409505 posted

    I have code to edit my mdb file with new comments from the form comments. but i get the error

    500 - Internal server error.
    There is a problem with the resource you are looking for, and it cannot be displayed.

    I am not sure what i am doing wrong . 

    <%
      option explicit
      Response.Buffer = True
    %>
    
    <!--#INCLUDE FILE="include/IncludePaths.asp"-->
    <!--#INCLUDE FILE="include/IncludeCommon.asp"-->
    <!--#INCLUDE FILE="include/IncludeDatabase.asp"-->
    
    <%
    '==============================================================================
    ' constants
    '==============================================================================
    Const FILE_NAME = "Edit.asp"
    Const TITLE = "Edit Results Set Information"
    dim oConn
    
    call OpenDatabase()
    
    
    if Request("Action") = "Edit" then
      call Update()
      CloseDatabase()
      Response.Redirect "Index.asp?Testbed=" & Request("Testbed") & "&ResultsSet=" & Request("ResultsSet")
    end if
    
    call WriteHeader(TITLE)
    call WriteBody()
    call WriteFooter()
    
    call CloseDatabase()
    
    '==============================================================================
    ' HTML content
    '==============================================================================
    sub OpenDatabase()
      set oConn = CreateObject("ADODB.Connection")
      'oConn.Open "PROVIDER=Microsoft Office 12.0 Access Database Engine OLE DB Provider;DATA SOURCE=" & SERVER_DIR & FOLDER & "\db\TestResultsRepository.mdb"
       oConn.Open "PROVIDER=Microsoft Office 12.0 Access Database Engine OLE DB Provider;DATA SOURCE=" & Server.MapPath("db\TestResultsRepositoryTest.mdb")
        
    end sub
    
    sub CloseDatabase()
      oConn.Close
      set oConn = nothing
    end sub
    
    sub WriteBody
      dim sSQL, oRS, sBaseline, sComments
    
      call OpenTable("#FFFFEE")
    %>
      <SCRIPT LANGUAGE="JavaScript">
        function SubmitForm()
        {
          document.testbedform.submit();
        }
      </SCRIPT>
    
        <form name="update" method="post" action="<% = FILE_NAME %>">
          <input type="hidden" name="hid_UpdateBaseline" value="False">
          <input type="hidden" name="ResultsSet" value="">
          <input type="hidden" name="Testbed" value="<% = Request("Testbed") %>">
        </form>
    
      <div class="wizardbody">
        <div class="wizardHeading">Edit Results Set Information</div>
        <div class="wizardtext">
          <form name="testbedform" method="get" action="<% = FILE_NAME %>">
            <table cellspacing=3 cellpadding=3 border=0>
            <tr><td>Testbed:</td><td>
            <%
              Response.Write CreateDropDownFromDictionary(GetListOfTestbeds(), "Testbed", Request("Testbed"), True, "", False, 0, "SubmitForm();")
            %>
            </td></tr>
            <tr><td>Results Set:</td><td><% Response.Write CreateDropDownFromDictionary(GetListOfTestResults(Request("Testbed")), "ResultsSet", Request("ResultsSet"), True, "", False, 0, "SubmitForm();")  %></td></tr>
    
            </table>
          </form>
    
          <br>
          <% if Request("Testbed") <> "" and Request("ResultsSet") <> "" then %>
            <div class="wizardtext">
    
            <form name="edit" method="post" action="<% = FILE_NAME %>">
              <b>Edit</b>
              <div class="wizardtext">
              <table cellspacing=3 cellpadding=3 border=0>
              <tr><td>Baseline:</td><td>
              <%
                 if Request("ResultsSet") <> "" then
                   sSQL = "Select BaselineTag, Comments FROM TagTable WHERE Testbed = '" & Request("Testbed") & "' AND Tag = '" & GetTagFromFilename(Request("ResultsSet")) & "'"
                   set oRS = oConn.Execute(sSQL)
                   if oRS.EOF then
                    sBaseline = ""
                    sComments = ""
                   else
                    sBaseline = oRS.Fields("BaselineTag") & ".mdb"
                    sComments = oRS.Fields("Comments")
                   end if
                   oRS.Close
                   set oRS = nothing
                 else
                  sBaseline = ""
                  sComments = ""
                 end if
                 Response.Write CreateDropDownFromDictionary(GetListOfTestResults(Request("Testbed")), "BaselineTag", sBaseline, True, "No Baseline", False, 0, "")
              %><input type="hidden" name="Action" value="Edit"></td></tr>
              <tr><td valign="top">Comments:</td><td><textarea rows=5 cols=60 name="comments"><% = sComments %></textarea></td></tr>
              <tr><td><input type=submit value="Update"></td></tr>
              </table>
              </div>
              <input type=hidden name="Testbed" value="<% = Request("Testbed") %>">
              <input type=hidden name="ResultsSet" value="<% = Request("ResultsSet") %>">
            </form>
            </div>
            </div>
          <% end if %>
        </div>
        </form>
       </div>
    <%
      call CloseTable()
    end sub
    
    sub DeleteResultsSetInfo()
      dim sSQL
      sSQL = "DELETE * FROM TagTable WHERE Testbed = '" & Request("Testbed")
      sSQL = sSQL & "' AND Tag = '" & GetTagFromFilename(Request("ResultsSet")) & "'"
      oConn.Execute sSQL
    end sub
    
    sub AddResultsSetInfo()
      dim sSQL
      'sSQL = "UPDATE Tag SET Comments ='" & Request("Comments") & "'WHERE Testbed ='" & Request("Testbed") & "' AND Tag='" & GetTagFromFilename(Request("ResultsSet")) & "' AND BaselineTag='" & GetTagFromFilename(Request("BaselineTag")) &"'"
      sSQL = "INSERT INTO Tag (Testbed, Tag, BaselineTag, Comments) VALUES "
      sSQL = sSQL & " ('" & Request("Testbed") & "', '" & GetTagFromFilename(Request("ResultsSet")) & "',"
      sSQL = sSQL & " '" & GetTagFromFilename(Request("BaselineTag")) & "', '" & replace(Request("Comments"), "'", "''") & "')"
      oConn.Execute sSQL
    end sub
    
    sub Update()
      call DeleteResultsSetInfo()
      'call AddResultsSetInfo()
    end sub
    
    %>

    Any help or suggestion regarding delete insert and update will be highly helpful for me.. Thanks in advance

    Friday, March 27, 2015 11:55 AM

Answers

All replies

  • User753101303 posted

    Hi,

    Don't guess. Error 500 is a server side error and you should be able to see an error message in the Windows log that would show the line and what gone wrong (or disable "simplified http error message" in your browser).

    If you need further help you would likely need to search a "classic ASP" forum. This forum is for ASP.NET which is the already old replacement for "Classic ASP". OIF if you are just starting to create something, I would suggest to use ASP.NET instead "webpages" will sound familiar already to you :

    http://www.asp.net/web-pages

    Friday, March 27, 2015 12:21 PM
  • User313409505 posted

    Hi,

    Thanks for the inputs.

    I am debugging the code everythign works fine till i try to delete the record in DeleteResultsSetInfo() code.

    I am not sure what's going wrong in this command. is there any diff in synstax from MICROSOFT.JET.OLEDB.4 and Microsoft Office 12.0 Access Database Engine OLE DB. 

    Any kind sample snippets ll help me in great deal.

    Friday, March 27, 2015 1:39 PM
  • User313409505 posted

    i got the reason for 500 errors.. in my server events i get this error

    "Warning: File /TestResultsRepository/Edit.asp Line 130 Could not delete from specified tables.. .""

    Friday, March 27, 2015 2:54 PM
  • User61956409 posted

    Hi jambagigirish,

    Thanks for your post.

    Firstly, you could refer to this similar issue.

    Secondly, this article describes how to troubleshoot HTTP 500 - Internal Server Error, please read it.

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 27, 2015 11:19 PM
  • User753101303 posted

    So from the message you can now a web search. Found https://support.office.com/en-ie/article/I-get-the-error-message-Could-not-delete-from-the-specified-tables-20dec5e8-5402-4667-802d-523cf4923a46

    Not using Access since long but my understanding is that your "table" might be actually a view and the Access engine doesn't know how to handle deletion in this view.

    Saturday, March 28, 2015 6:08 AM