473,583 Members | 3,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

add new data in ms access using asp

46 New Member
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 1522
jhardman
3,406 Recognized Expert Specialist
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 New Member
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..than k again
erm..maybe you can give me your email so i can ask your help again
Sep 19 '07 #3
jhardman
3,406 Recognized Expert Specialist
thanks Jared..your already help me..your code work perfectly..than k 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
5743
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 modified that is to upgrade a big, more than 100,000 lines DOS based program developed by FoxPro 2.x to .NET platform. The design is as previous and...
0
5379
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 Application Block (DAAB) in our .Net projects. We use SqlHelper in SQL based projects, and OracleHelper in Oracle based ones. OracleHelper was not...
12
2662
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 ) {cout<<"a.value="<<a.value<<endl; } private: int value;
32
3211
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 lost when they move to a new record. This seems to be the case when there are multiple users. When there is a single user using it, we don't seem to...
9
3295
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 >people moving from power user to developer, but now I suggest you browse >it, >too. It strongly emphasizes ADO, which knowledgeable Microsoft...
3
3482
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 site that has this prohibition, and I have uploaded DAPs to various sites and used them from those sites. I do not understand why any site...
9
2627
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) making it invisible and have used this whenever i needed it. dat1.databasename = app.path & "mydatabase.mdb" dat1.recordsource = "my query"...
1
2574
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 looking for a robust solution for a major application. Almost every developer seems to come up with a completely different solution. While many of them...
20
37869
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, then import it into SQL Server. I've tried that, and the speed is acceptable. It is an ugly solution, however, and I expect to find a better one --...
6
2404
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 connection string works fine and the tables are added to the project without a problem. When I create the tables they appear to bind and I am able to...
0
7890
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7815
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7926
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8187
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3812
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1418
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1149
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.