Error on SQL Insert Statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mgrichen
    New Member
    • Feb 2013
    • 8

    Error on SQL Insert Statement

    I am using IIS on Windows 7 Enterprise.
    The following lines of code are an asp page with vbscript calling a MySQL database.

    Code:
    <!--#INCLUDE file="header.asp"-->
    <html>
    <%
    	
    	iRegion=request.querystring("fRegion")
    	response.write iRegion & "<br/>"
    	Set myConnection = Server.CreateObject("ADODB.Connection")
    	myConnection.ConnectionString = "driver={MySQL ODBC 5.3 Unicode};" & _
    		"server=localhost;" & _
    		"uid=myUser;" & _
    		"pwd=myPassword;" & _
    		"database=myDB;"
    	response.write myConnection.ConnectionString & "<br>"
    	myConnection.open "GenixSQL"
    %>
    
    <head>
    	<meta http-equiv="Content-Language" content="pt">
    	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    	<title>Testes de Inserção</title>
    </head>
    
    <body  bgcolor="#000000" link="#66CCFF" vlink="#CC66FF" alink="#FFCC99" text="#66CCFF">
        <!-- TEST -->
        <h3 align="center">Insertion Test: MySQL56 Instance</h3><br>
        <%
        insRegion = "INSERT INTO TESTE (testeDS) VALUES ('" + iRegion + "')"
        myConnection.Execute insRegion
        response.write insRegion & "<br/>"
        set myConnection = Nothing
        myConnection.close
        %>
        <a href="index.htm">Home Page</a>
    </body>
    </html>
    When running the asp page I get a very generic error message "An error occurred on the server when processing the URL. Please contact the system administrator."

    Despite the error the database is updated.

    Could anyone help please.

    Thank you in advance.
    Last edited by Rabbit; Aug 14 '14, 10:37 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    The webserver should have create a log file, did you have a look in the log file?

    What is returned to the browser? For debugging purposes Fidller it the tool to use

    Comment

    • mgrichen
      New Member
      • Feb 2013
      • 8

      #3
      The following is returned by the web browser:


      ------------------------------------------
      New York
      Insertion Test: MySQL56 Instance


      INSERT INTO TESTE (testeDS) VALUES ('New York')
      An error occurred on the server when processing the URL. Please contact the system administrator.
      If you are the system administrator please click here to find out more about this error.
      --------------------------------------------------

      I can see that the variable fRegion="New York" is returned by the form and the variable iRegion=fRegion is present in the Insert statement. I check the database and the value "New Youk" has been added but still the same error.

      Comment

      • Luuk
        Recognized Expert Top Contributor
        • Mar 2012
        • 1043

        #4
        i'm sorry, i don't do stuff with asp, and this seems to be an asp error.

        Comment

        • mgrichen
          New Member
          • Feb 2013
          • 8

          #5
          Thanks anyway.
          I found the error:
          I removed
          set myConnection = Nothing
          and it is working without error.

          Comment

          Working...