472,143 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

add new data in ms access using asp

46
this is my coding..when i run this coding, it give me an error

Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.

anybody can help me
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  3. <title>processor</title>
  4. </head>
  5.  
  6. <body>
  7. <!--#include file="adovbs.inc"-->
  8.  
  9. <%
  10. dim cstrdes 
  11. dim ccurprice 
  12.  
  13. cstrdes = request.form("des")
  14. scurprice = request.form("price") 
  15.  
  16. dim objconn
  17. set objconn = server.createobject("ADODB.connection")
  18. objconn.provider = "Microsoft.Jet.OLEDB.4.0"
  19. objconn.ConnectionString = "Data Source=" & Server.MapPath("product.mdb")
  20. objconn.mode = 3
  21. objconn.open
  22.  
  23. mysql= "insert into processor(description,price) values ('cstrdes','ccurprice');"
  24. objconn.execute(mysql)
  25.  
  26.  response.redirect("home.asp") %>
  27.  
  28. </body>
  29. </html>
Sep 18 '07 #1
3 1413
jhardman
3,406 Expert 2GB
The problem is in the line:

mysql= "insert into..."

I try to avoid using insert statemnets (you can accomplish the same effects with codes that seem simpler to me) but I believe that you need something more like this:
Expand|Select|Wrap|Line Numbers
  1. mysql = "INSERT INTO processor(description, price) VALUES ('"
  2. mysql = mysql & cstrdes & "','" & ccurprice & "');"
This may still cause an error if I understand your code right. Only strings are supposed to be in single quotes and ccurprice is probably numeric. I can't tell cstrdes is supposed to be, but I will assume it is a string, in which case the line should look like this (I'm just taking out the single quotes around ccurprice)
Expand|Select|Wrap|Line Numbers
  1. mysql = "INSERT INTO processor(description, price) VALUES ('"
  2. mysql = mysql & cstrdes & "'," & ccurprice & ");"
Let me know if this works.

Jared
Sep 18 '07 #2
najmi
46
The problem is in the line:

mysql= "insert into..."

I try to avoid using insert statemnets (you can accomplish the same effects with codes that seem simpler to me) but I believe that you need something more like this:
Expand|Select|Wrap|Line Numbers
  1. mysql = "INSERT INTO processor(description, price) VALUES ('"
  2. mysql = mysql & cstrdes & "','" & ccurprice & "');"
This may still cause an error if I understand your code right. Only strings are supposed to be in single quotes and ccurprice is probably numeric. I can't tell cstrdes is supposed to be, but I will assume it is a string, in which case the line should look like this (I'm just taking out the single quotes around ccurprice)
Expand|Select|Wrap|Line Numbers
  1. mysql = "INSERT INTO processor(description, price) VALUES ('"
  2. mysql = mysql & cstrdes & "'," & ccurprice & ");"
Let me know if this works.

Jared

thanks Jared..your already help me..your code work perfectly..thank again
erm..maybe you can give me your email so i can ask your help again
Sep 19 '07 #3
jhardman
3,406 Expert 2GB
thanks Jared..your already help me..your code work perfectly..thank again
erm..maybe you can give me your email so i can ask your help again
I'd like to keep questions in the forum in case it would help someone else, but if you want my help in particular, feel free to send me a PM asking me to look into a particular thread. Of course if you want me to look over sensitive information I guess we can bend the rules a bit...

Jared
Sep 19 '07 #4

Post your reply

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

Similar topics

32 posts views Thread by Neil Ginsberg | last post: by
9 posts views Thread by Tony Lee | last post: by
3 posts views Thread by Lyle Fairfield | last post: by
6 posts views Thread by Wesley Peace | last post: by
reply views Thread by leo001 | last post: by

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.