473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Unable to Add Record to DB Table Using ASP

Hello,

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
  1. <html>
  2. <body>
  3.  
  4. <form method="post" action="inventory_add.asp">
  5. <table>
  6. <tr>
  7. <td>sku:</td>
  8. <td><input name="sku"></td>
  9.  
  10. </tr><tr>
  11. <td>model</td>
  12. <td><input name="model"></td>
  13.  
  14.  
  15. </tr><tr>
  16. <td>type</td>
  17. <td><input name="type"></td>
  18.  
  19.  
  20. </tr><tr>
  21. <td>color</td>
  22. <td><input name="color"></td>
  23.  
  24. </tr><tr>
  25. <td>sizing</td>
  26. <td><input name="sizing"></td>
  27.  
  28.  
  29. </tr><tr>
  30. <td>quantity</td>
  31. <td><input name="quantity"></td>
  32.  
  33. </tr>
  34. </table>
  35. <br /><br />
  36. <input type="submit" value="Add New">
  37. <input type="reset" value="Cancel">
  38. </form>
  39.  
  40. </body>
  41. </html> 
And here is the inventory_add.asp script:
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/tmg.mdb"))
  19.  
  20.  
  21.  
  22. sql="INSERT INTO [Inventory] (sku,itemnumber,"
  23. sql=sql & "style,color,quantity,location)"
  24. sql=sql & " VALUES "
  25. sql=sql & "'" & Request.Form("sku") & "',"
  26. sql=sql & "'" & Request.Form("itemnumber") & "',"
  27. sql=sql & "'" & Request.Form("style") & "',"
  28. sql=sql & "'" & Request.Form("color") & "',"
  29. sql=sql & "'" & Request.Form("quantity") &"',"
  30. sql=sql & "'" & Request.Form("location") & "'"
  31.  
  32. on error resume next
  33. conn.Execute sql,recaffected
  34. if err<>0 then
  35.   Response.Write("Please contact Tech Support - 904.733.0030")
  36. else
  37.   response.redirect "http://www.shipping-and-handling.com/clientlogin/tmg/update.asp"
  38. end if
  39. conn.close
  40. %>
  41.  
  42. </body>
  43. </html> 
  44.  
  45. </body>
  46. </html>
The error that is happening is my own - the script throws the "Please Contact Tech Support" error. So I am not sure what is occurring.

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
Mar 25 '14 #1

✓ answered by Rabbit

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.

4 1479
Rabbit
12,516 Expert Mod 8TB
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
This is my error now: Microsoft JET Database Engine error '80040e14'

Syntax error in INSERT INTO statement.

/clientlogin/iko/inventory_add.asp, line 31
Mar 26 '14 #3
Well.. I am not entirely sure how I fixed it, but I fixed it... the suggestion to change out the error message was the correct one as it definitely helped me troubleshoot! Thanks Rabbit!
Mar 26 '14 #4
Rabbit
12,516 Expert Mod 8TB
Now that we know where to look for the error, I can figure out what went wrong.

The insert SQL syntax should look like this:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tableName (column list)
  2. VALUES (value list)
In your code, you were missing the enclosing parentheses on the value list.
Mar 26 '14 #5

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

Similar topics

7
by: Warren Wright | last post by:
Hello, We maintain a 175 million record database table for our customer. This is an extract of some data collected for them by a third party vendor, who sends us regular updates to that data...
2
by: LVande | last post by:
SQLLY challenged be gentle -- Trying to create code that will drop a table using a variable as the Table Name. DECLARE @testname as char(50) SELECT @testname = 'CO_Line_of_Business_' +...
3
by: GL | last post by:
Hi, Is there a way to add a field to an existing table using a query of some sort (without needing to manually add a field to the table). I know how to do it with a make table query, but I have...
4
by: Nathan Sokalski | last post by:
When editing an ASP Table, Visual Studio does not allow me to edit it in Design View. This makes it harder to add elements, because I must add every element either by using Design View to create...
0
by: bimeldip | last post by:
Hi, I have managed to create codes to display data from the database in a html page.I have gone on to create a page to allow users to manipulate the table via a html page. For instance users will be...
4
by: Craggy | last post by:
I need to be able to add a record directly into a table using vba. The table is not the same table that is being used on my current form. Basically I want to have a question with a list box...
13
nabh4u
by: nabh4u | last post by:
hi, I am trying to insert multiple rows in a table using PL/SQL. I have two procedures and two tables. the first procedure gets the data from the source table, manipulates it and then sends the...
6
by: nicolenwn | last post by:
Hi everyone(: I'm having trouble creating pivot tables using macros. First i tried recording it then running the exact same thing. It worked fine the first time but a week later when i tried...
1
Seth Schrock
by: Seth Schrock | last post by:
I'm creating a billing database and currently, I'm pulling records from the sales table using the current CustomerID, and two textboxes to give a date range as the criteria for the query. From here,...
1
by: lolo87 | last post by:
I exported a one column table using datatype text from SQL. As a txt and tried as Del file. I am trying to import this file in DB2. I created a table in DB2 using one column CLOB. Every time I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.