My ASP isn't Working Right... please help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aaronsah
    New Member
    • Feb 2014
    • 10

    My ASP isn't Working Right... please help

    I am having trouble with an ASP page that is intended for inventory purposes. Basically, it uses a web interface to allow a user to enter information on a database, and it writes information to the database which is on the same web server as the ASP page.

    However, when attempting to access the ASP page, it throws the error that I have written in at the bottom of the page.

    There is no problem with connectivity to the database or anything like that, because I can add items to it using a different ASP page, and it uses the same fields.

    I will provide the code for the ASP, and then screen shot the database in datasheet view and design view.

    Thanks for any assistance that can be provided.

    Code:
    
    <html>
    <head>
    
    <script type="text/javascript">
    function goback()
    {
    history.go(-1)
    }
    </script>
    
    </head>
    
    
    <body>
    <%
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.Mappath("/clientlogin/db/iko.mdb"))
    
    cid=Request.Form("sku")
    
    
      
    
    
      if Request.form("sku")="" then
      set rs=Server.CreateObject("ADODB.Recordset") 
      sql="SELECT SKU, model, type, color, sizing, quantity FROM inventory WHERE sku="',"
      sql= sql+cid
      rs.open sql,conn
      %>
    
      <form name="update" method="post" action="inventory_update.asp">
      <table>
      <%for each x in rs.Fields%>
      <tr>
      <td><%=x.name%></td>
      <td><input name="<%=x.name%>" value="<%=x.value%>"></td>
      <%next%>
      </tr>
      </table>
      <br /><br />
      <input type="submit" name="action" value="Save">
    <input type="submit" name="action" value="Delete">
    
      <INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="goback()">
      </form>
    <%
    elseif Request.Form("action")="Delete" then
      sql="DELETE FROM inventory"
      sql=sql & " WHERE sku="
      sql=sql+cid
      conn.Execute sql
      response.redirect "http://www.shipping-and-handling.com/clientlogin/iko/update.asp"
    
     
    else
      sql="UPDATE inventory (sku,model,"
      sql=sql & "type,color,sizing,quantity)"
      sql=sql & " VALUES "
      sql=sql & "('" & Request.Form("sku") & "',"
    sql=sql & "'" & Request.Form("model") & "',"
    sql=sql & "'" & Request.Form("type") & "',"
    sql=sql & "'" & Request.Form("color") & "',"
    sql=sql & "'" & Request.Form("sizing") & "',"
    sql=sql & "'" & Request.Form("quantity") & "')"
      sql=sql+cid
      
      on error resume next
      conn.Execute sql
      if err <>0 then
        response.write("You're having technical issues. Call Aaron 904.733.0030 or aaron at shipping-and-handling dot com")
      else
        response.redirect "http://www.shipping-and-handling.com/clientlogin/iko/update.asp"
      end if
    end if
    conn.close
    %>
    
    
    
    </body>
    </html>
    And here is the database in datasheet view:


    Here is design view:
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You should write out the actual error message and number and not a generic one that you created. The actual error message will tell you more about what the problem is.

    Comment

    • aaronsah
      New Member
      • Feb 2014
      • 10

      #3
      Hi Rabbit... I'm a little new to ASP and everything, and have adapted some already-been-used code to suit my purposes... that's a long way of saying, how do I do what you suggested? Thanks!

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        The quickest and easiest way would be to take out the custom error handling. You can put back the custom error handling after you fix the main errors.

        Comment

        Working...