473,721 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

delete data in ms access using asp

46 New Member
this my coding..
Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim cintid
  3. cintid = request.form("txtid")
  4. dim objconn
  5. set objconn = server.createobject("ADODB.connection")
  6. objconn.provider = "Microsoft.Jet.OLEDB.4.0"
  7. objconn.ConnectionString = "Data Source=" & Server.MapPath("product.mdb")
  8. objconn.mode = 3
  9. objconn.open
  10.  
  11. mysql = "delete * from processor where id-no = " & cintid & ";"
  12.  
  13. objconn.execute(mysql)
  14.  
  15.  response.redirect("home.asp") %>
when i run, it give me an error
Expand|Select|Wrap|Line Numbers
  1. Error Type:
  2. Microsoft JET Database Engine (0x80040E10)
  3. No value given for one or more required parameters.
please help me..i dont know where is my error..
Sep 20 '07 #1
23 4809
jhardman
3,406 Recognized Expert Specialist
the minus sign (hyphen) is a special character in SQL. "id-no" should be enclosed in square brackets like this:
Expand|Select|Wrap|Line Numbers
  1. mysql = "DELETE * FROM processor WHERE [id-no] = " & cintid & ";"
I have decided this is so tedious I would rather rename all of my db fields without hyphens. Let me know if this solves the problem.

Jared
Sep 20 '07 #2
najmi
46 New Member
the minus sign (hyphen) is a special character in SQL. "id-no" should be enclosed in square brackets like this:
Expand|Select|Wrap|Line Numbers
  1. mysql = "DELETE * FROM processor WHERE [id-no] = " & cintid & ";"
I have decided this is so tedious I would rather rename all of my db fields without hyphens. Let me know if this solves the problem.

Jared
it worked..thank again..i have one more problem again about updating data..here my coding..

mysql = "update processor set description = " & cstrdes & "& price =" & ccurprice & ";"

it give me an error:

Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.

this error is same as my last error in add data..
Sep 22 '07 #3
jhardman
3,406 Recognized Expert Specialist
it worked..thank again..i have one more problem again about updating data..here my coding..

mysql = "update processor set description = " & cstrdes & "& price =" & ccurprice & ";"

it give me an error:

Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.

this error is same as my last error in add data..
the ampersand (&) is not recognized in SQL. You need to use the word "AND" like this:
Expand|Select|Wrap|Line Numbers
  1. mysql = "update processor set description = " & cstrdes & " AND price =" & ccurprice &  ";"
after this line you can print "mysql" to see what it gives you. Some database managers have a function where you can test you SQL queries. It should say something like this:
Expand|Select|Wrap|Line Numbers
  1. update processor set description = 432 AND price = 12.67
Let me know if this works.

Jared
Sep 22 '07 #4
najmi
46 New Member
the ampersand (&) is not recognized in SQL. You need to use the word "AND" like this:
Expand|Select|Wrap|Line Numbers
  1. mysql = "update processor set description = " & cstrdes & " AND price =" & ccurprice &  ";"
after this line you can print "mysql" to see what it gives you. Some database managers have a function where you can test you SQL queries. It should say something like this:
Expand|Select|Wrap|Line Numbers
  1. update processor set description = 432 AND price = 12.67
Let me know if this works.

Jared

it didn`t work i give my full coding:
Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim cstrdes,ccurprice
  3. cstrdes = request.form("txtdes")
  4. ccurprice = request.form("txtprice")
  5. dim objconn
  6. set objconn = server.createobject("ADODB.connection")
  7. objconn.provider = "Microsoft.Jet.OLEDB.4.0"
  8. objconn.ConnectionString = "Data Source=" & Server.MapPath("product.mdb")
  9. objconn.mode = 3
  10. objconn.open
  11.  
  12. mysql = "update processor set description = " & cstrdes & " AND price =" & ccurprice &  ";"
  13. objconn.execute(mysql)
  14.  
  15.  response.redirect("home.asp") %>
err:
Expand|Select|Wrap|Line Numbers
  1. Microsoft JET Database Engine (0x80040E14)
  2. Syntax error (missing operator) in query expression 'Intel Dual Core AND price =300'.
Sep 22 '07 #5
najmi
46 New Member
this is my coding:

<%
dim cstrdes,ccurpri ce
cstrdes = request.form("t xtdes")
ccurprice = request.form("t xtprice")
dim objconn
set objconn = server.createob ject("ADODB.con nection")
objconn.provide r = "Microsoft.Jet. OLEDB.4.0"
objconn.Connect ionString = "Data Source=" & Server.MapPath( "product.md b")
objconn.mode = 3
objconn.open

mysql = "update processor set description =" & cstrdes & " AND price =" & ccurprice & ";"
objconn.execute (mysql)

response.redire ct("home.asp") %>

when i run it give me an err:

Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'Intel Dual Core AND price =300'.

please help me..
Sep 24 '07 #6
shweta123
692 Recognized Expert Contributor
Hi,

I think , your sql statement is missing quotes. So try putting it this way,

mysql = "update processor set description ='" & cstrdes & "' AND price =" & ccurprice & ";"
objconn.execute (mysql)
Sep 24 '07 #7
jhardman
3,406 Recognized Expert Specialist
1- numeric values should not be in quotes, but text values (strings) should be in single quotes. Since the price is a numerical value it should not be in quotes (you got that part right) but the description is a string so it should be in quotes. Your line 12 should look like this:
Expand|Select|Wrap|Line Numbers
  1. mysql = "update processor set description = '" & cstrdes & "' AND price =" & ccurprice &  ";"
2- between lines 12 & 13 put this line:
Expand|Select|Wrap|Line Numbers
  1. response.write mysql & "<br>" & vbNewLine
This will show how your statement ends up before it is sent to the db and causes an error. It should look like this:
Expand|Select|Wrap|Line Numbers
  1. update processor set description = 'Intel Dual Core' AND price =300;
Notice that the value of description is in quotes.

Jared
Sep 24 '07 #8
jhardman
3,406 Recognized Expert Specialist
Please don't double-post questions. If you want, it is appropriate to send private messages to site experts asking them to read and reply to a particular post.

Jared
Sep 24 '07 #9
najmi
46 New Member
it still not work..i have modified a little bit my coding..it will be like this:

<%
dim cstrdes,ccurpri ce,cintid
cintid = request.form("t xtid")
cstrdes = request.form("t xtdes")
ccurprice = request.form("t xtprice")
dim objconn
set objconn = server.createob ject("ADODB.con nection")
objconn.provide r = "Microsoft.Jet. OLEDB.4.0"
objconn.Connect ionString = "Data Source=" & Server.MapPath( "product.md b")
objconn.mode = 3
objconn.open

mysql = "update processor set description ='" & cstrdes & "' AND price =" & ccurprice & "where [id-no] = " & cintid & ";"
objconn.execute (mysql)

response.redire ct("home.asp") %>


err:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression ''cat' AND price =32where [id-no] = 34'.
Sep 25 '07 #10

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

Similar topics

7
1722
by: Mike & Dyan | last post by:
I was able to figure out how to insert new data into my database. But for some reason and a lot of reading I can't seem to figure out how to delete any data. My app is going to be used for tracking info on vehicles. My app is MDI with 3 children. 1 is for selecting a car(already in the database) and input info.Then you can add that car and info to the database. Another is used for just adding or deleting a car to the database. The 3rd...
16
3872
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but couldn't find anything. the context: we have some java folk who like to parametize/
1
3480
by: Greg | last post by:
I run some reports from the web that is connected to an Access database. I run a macro every 25 minutes that deletes the tables and then appends data to the tables with fresh data. The issue I have is that between the delete and append there is a 4 minute window when reports cannot be generated since the tables are empty due to the delete query. Is there method to replace the table with data without having the down time during the delete...
14
8085
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I think I could have easily done this using joins, but I kept getting "could not delete from specified tables" errors. Some google searching has indicated I need to use a subquery. After many failed attempts with different approaches, I finally...
2
5065
by: NoSpam | last post by:
Hi, I am working with C# and ASP.NET with code behind and a SQL Server. I'm making an e-shop. When clients see what they have in their basket, I added a function DELETE to delete a line. It took me hours to get it working in both the dataset and the database itself. It works now, but the code looks so ugly to me. Can someone tell me what I use too much, and what could be changed? I am using a temporary table to store the basket with an...
3
2791
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine, but users have requested a confirmation message pop up so the user can confirm the delete. I can not quite get this to work. Here are the facts: I am working in the Microsoft Development Environment 2003 (Version
2
3256
by: Rich | last post by:
Hello, I have an oleDBDataAdapter (da1) which gets data from an Access mdb and fills a dataset (ds1) with integer data from "tbl1" in Access. Data displays in textboxes on a form. The textboxes are bound to columns in the dataset. This works correctly. I have been struggling with invoking da1.Update(ds1, "tbl1") and with help from the group here have overcome this obstacle (many thanks for the help). But I need to be able to Insert...
13
2861
by: forbes | last post by:
Hi, I have a user that used the Query Wizard to create a query in Access. Now she claims that her master table is missing all the data that was excluded from the query. Can you create anything other than a select query using the Wizard? What do you think happened to her data? I am working remotely until Friday, so I can't get down to her office and check out what she did.
1
2346
by: SteveBark | last post by:
Hello all I am currently trying to develop a script that will take a value from an Excel spreadsheet cell and use that to run a query against an Access table to delete all rows that match the cell. I have tried to do this by first using a recordset and then secondly using a db.Execute (sqlstring). The idea of using the recordset was that I thought it would return all of the records matched, however it just deletes the 1 row not all of...
2
17454
by: MLH | last post by:
Am using A97. Have defined Machine Data Source type DSNs in Access' File, Get External Data, Link Tables, Files of Type ODBC, Machine Data Source tab. Have many definitions. Would like to delete some. Would like to edit some. How to delete? I don't think editing is possible.
0
8840
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9367
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9131
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9064
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3189
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
3
2130
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.