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

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

P: 10
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.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <html>
  4. <head>
  5.  
  6. <script type="text/javascript">
  7. function goback()
  8. {
  9. history.go(-1)
  10. }
  11. </script>
  12.  
  13. </head>
  14.  
  15.  
  16. <body>
  17. <%
  18. set conn=Server.CreateObject("ADODB.Connection")
  19. conn.Provider="Microsoft.Jet.OLEDB.4.0"
  20. conn.Open(Server.Mappath("/clientlogin/db/iko.mdb"))
  21.  
  22. cid=Request.Form("sku")
  23.  
  24.  
  25.  
  26.  
  27.  
  28.   if Request.form("sku")="" then
  29.   set rs=Server.CreateObject("ADODB.Recordset") 
  30.   sql="SELECT SKU, model, type, color, sizing, quantity FROM inventory WHERE sku="',"
  31.   sql= sql+cid
  32.   rs.open sql,conn
  33.   %>
  34.  
  35.   <form name="update" method="post" action="inventory_update.asp">
  36.   <table>
  37.   <%for each x in rs.Fields%>
  38.   <tr>
  39.   <td><%=x.name%></td>
  40.   <td><input name="<%=x.name%>" value="<%=x.value%>"></td>
  41.   <%next%>
  42.   </tr>
  43.   </table>
  44.   <br /><br />
  45.   <input type="submit" name="action" value="Save">
  46. <input type="submit" name="action" value="Delete">
  47.  
  48.   <INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="goback()">
  49.   </form>
  50. <%
  51. elseif Request.Form("action")="Delete" then
  52.   sql="DELETE FROM inventory"
  53.   sql=sql & " WHERE sku="
  54.   sql=sql+cid
  55.   conn.Execute sql
  56.   response.redirect "http://www.shipping-and-handling.com/clientlogin/iko/update.asp"
  57.  
  58.  
  59. else
  60.   sql="UPDATE inventory (sku,model,"
  61.   sql=sql & "type,color,sizing,quantity)"
  62.   sql=sql & " VALUES "
  63.   sql=sql & "('" & Request.Form("sku") & "',"
  64. sql=sql & "'" & Request.Form("model") & "',"
  65. sql=sql & "'" & Request.Form("type") & "',"
  66. sql=sql & "'" & Request.Form("color") & "',"
  67. sql=sql & "'" & Request.Form("sizing") & "',"
  68. sql=sql & "'" & Request.Form("quantity") & "')"
  69.   sql=sql+cid
  70.  
  71.   on error resume next
  72.   conn.Execute sql
  73.   if err <>0 then
  74.     response.write("You're having technical issues. Call Aaron 904.733.0030 or aaron at shipping-and-handling dot com")
  75.   else
  76.     response.redirect "http://www.shipping-and-handling.com/clientlogin/iko/update.asp"
  77.   end if
  78. end if
  79. conn.close
  80. %>
  81.  
  82.  
  83.  
  84. </body>
  85. </html>
And here is the database in datasheet view:



Here is design view:

Mar 21 '14 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,370
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.
Mar 25 '14 #2

P: 10
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!
Mar 25 '14 #3

Rabbit
Expert Mod 10K+
P: 12,370
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.
Mar 25 '14 #4

Post your reply

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