By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,659 Members | 1,742 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,659 IT Pros & Developers. It's quick & easy.

ASP is Throwing My Error Message When Attempting Write to DB

P: 10
My previous question was here:
http://bytes.com/topic/access/answer...to-80040e07-da

That got rid of the MS error, but now I am receiving the error message I built into it - so something is still going wrong.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.  
  4. <script type="text/javascript">
  5. function goback()
  6. {
  7. history.go(-1)
  8. }
  9. </script>
  10.  
  11. </head>
  12.  
  13.  
  14. <body>
  15. <%
  16. set conn=Server.CreateObject("ADODB.Connection")
  17. conn.Provider="Microsoft.Jet.OLEDB.4.0"
  18. conn.Open(Server.Mappath("/clientlogin/db/jcb.mdb"))
  19.  
  20. cid=Request.Form("SKU")
  21.  
  22.  
  23.  
  24.  
  25.  
  26.   if Request.form("SKU")="" then
  27.   set rs=Server.CreateObject("ADODB.Recordset")
  28.   rs.open "SELECT SKU, Style, itemnumber, Color, Quantity, Location, lastmod  FROM inventory WHERE SKU=" & cid & "'", conn
  29.   %>
  30.  
  31.   <form method="post" action="inventory_update.asp">
  32.   <table>
  33.   <%for each x in rs.Fields%>
  34.   <tr>
  35.   <td><%=x.name%></td>
  36.   <td><input name="<%=x.name%>" value="<%=x.value%>"></td>
  37.   <%next%>
  38.   </tr>
  39.   </table>
  40.   <br /><br />
  41.   <input type="submit" name="action" value="Save">
  42. <input type="submit" name="action" value="Delete">
  43.  
  44.   <INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="goback()">
  45.   </form>
  46. <%
  47. elseif Request.Form("action")="Delete" then
  48.   sql="DELETE FROM inventory"
  49.   sql=sql & " WHERE sku='" & cid & "'"
  50.   conn.Execute sql
  51.   response.redirect "http://www.shipping-and-handling.com/clientlogin/jcb/update.asp"
  52.  
  53.  
  54. else
  55.   sql="UPDATE inventory SET "
  56.   sql=sql & "style='" & Request.Form("style") & "',"
  57.   sql=sql & "itemnumber='" & Request.Form("itemnumber") & "',"
  58.   sql=sql & "color='" & Request.Form("color") & "',"
  59.   sql=sql & "quantity='" & Request.Form("quantity") & "',"
  60.   sql=sql & "location='" & Request.Form("location") & "',"
  61.   sql=sql & "lastmod=(date())"
  62.   sql=sql & " WHERE sku='" & cid & "'"
  63.   on error resume next
  64.   conn.Execute sql
  65.   if err<>0 then
  66.     response.write("A dyslexic man walks into a bra... (you're having technical issues. Call Aaron 904.733.0030 or aaron at shipping-and-handling dot com)")
  67.   else
  68.     response.redirect "http://www.shipping-and-handling.com/clientlogin/jcb/update.asp"
  69.   end if
  70. end if
  71. conn.close
  72. %>
I'm getting the response for the "if err<>0" portion. I am not sure what is occurring.

Thanks for any assistance provided. This is my first time with ASP. :)
Feb 27 '14 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,370
You should write out the actual error message and number.
Feb 27 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.