I am attempting to add a record to a database using an HTML page that collects the data entered and sends it to an ASP script to then write to an online database. However, in testing, I am unable to successfully execute the command.
Here is the code for the HTML portion:
Expand|Select|Wrap|Line Numbers
- <html>
- <body>
- <form method="post" action="inventory_add.asp">
- <table>
- <tr>
- <td>sku:</td>
- <td><input name="sku"></td>
- </tr><tr>
- <td>model</td>
- <td><input name="model"></td>
- </tr><tr>
- <td>type</td>
- <td><input name="type"></td>
- </tr><tr>
- <td>color</td>
- <td><input name="color"></td>
- </tr><tr>
- <td>sizing</td>
- <td><input name="sizing"></td>
- </tr><tr>
- <td>quantity</td>
- <td><input name="quantity"></td>
- </tr>
- </table>
- <br /><br />
- <input type="submit" value="Add New">
- <input type="reset" value="Cancel">
- </form>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- <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/tmg.mdb"))
- sql="INSERT INTO [Inventory] (sku,itemnumber,"
- sql=sql & "style,color,quantity,location)"
- sql=sql & " VALUES "
- sql=sql & "'" & Request.Form("sku") & "',"
- sql=sql & "'" & Request.Form("itemnumber") & "',"
- sql=sql & "'" & Request.Form("style") & "',"
- sql=sql & "'" & Request.Form("color") & "',"
- sql=sql & "'" & Request.Form("quantity") &"',"
- sql=sql & "'" & Request.Form("location") & "'"
- on error resume next
- conn.Execute sql,recaffected
- if err<>0 then
- Response.Write("Please contact Tech Support - 904.733.0030")
- else
- response.redirect "http://www.shipping-and-handling.com/clientlogin/tmg/update.asp"
- end if
- conn.close
- %>
- </body>
- </html>
- </body>
- </html>
I checked and made sure that SKU and Quantity are Number fields in the database, and everything else is Short Text.
Any assistance is much appreciated.
Thanks