473,387 Members | 1,517 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,387 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 1519
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

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

Similar topics

6
by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
12
by: Manolis | last post by:
Hi, I was wondering if there is any way to make two objects of the same class to be able to access each other's private data, like this: class A { public: void access( const A& a )...
32
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being...
9
by: Tony Lee | last post by:
Some time a ago, on this newsgroup the following comments were made in recommending good references for Access (2003) >I used to recommend Dr. Rick Dobson's, "Programming Access <version>" for...
3
by: Lyle Fairfield | last post by:
In a recent thread there has been discussion about Data Access Pages. It has been suggested that they are not permitted on many or most secure sites. Perhaps, that it is so, although I know of no...
9
by: the_grove_man | last post by:
I guess my question can go in two directions. I create applications that run multiple queries against a database. Generally speaking in the past I have used a Data Control (calling it dat1)...
1
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am...
20
by: TC | last post by:
I need an automated procedure to copy data from an Access table to a SQL Server table. Speed is important. What is the recommended technique? I can export the data from Access, copy it via FTP,...
6
by: Wesley Peace | last post by:
I hate to cross post, but I've gotten no answer yet on a problem I'm having with visual studio 2008. I've created a series of forms with controls to access a Access database tables. The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.