473,516 Members | 3,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp w/ access SQL error... help please

I'm using classic ASP with an Access 2003 database, running on Win
2003 Server (IIS 6), trying to update a table and get the following
error:

[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement. - Err.Number:-2147217900 - SQL:UPDATE shipments SET
shipmentDescription='$0 - $

Here's my script:

dim SQL, connTemp, rsTemp

pIdShipment = request.Form("idShipment")
pShipmentDescription = request.form("shipmentDescription")
pPriceToAdd = request.form("priceToAdd")
pPercentageToAdd = request.form("percentageToAdd")
pShipmentTime = request.form("shipmentTime")

pQuantityFrom = request.form("quantityFrom")
pQuantityTo = request.form("quantityTo")

pWeightFrom = request.form("weightFrom")
pWeightTo = request.form("weightTo")

pPriceFrom = request.form("priceFrom")
pPriceTo = request.form("priceTo")

pIdZone = request.form("shippingZone")
pIdCustomerType = request.form("customerType")

' validate
if pShipmentDescription="" then
response.redirect "modifyShipmentForm.asp?
idShipment="&pIdShipment&"&message="& Server.Urlencode("Please enter a
valid shipment description")
end if

' update shipment in to db

SQL="UPDATE shipments SET shipmentDescription='"
&pShipmentDescription& "', priceToAdd=" &pPriceToAdd& ",
percentageToAdd=" &pPercentageToAdd& ", shipmentTime='"
&pShipmentTime& "', quantityFrom=" &pQuantityFrom& ", quantityTo="
&pQuantityTo& ", weightFrom=" &pWeightFrom& ", weightTo=" &pWeightTo&
", priceFrom=" &pPriceFrom& ", priceTo=" &pPriceTo& ",
idShippingZone=" &pIdZone& ", idCustomerType=" &pIdCustomerType& "
WHERE idShipment=" &pIdShipment

set connTemp = server.createObject("adodb.connection")

connTemp.Open DSN=MSC

set rsTemp=connTemp.execute(SQL)
The shipmentDescription and ShipmentTime columns are text fields,
everything else is number fields in Access.

Any ideas on what I'm doing wrong?

May 31 '07 #1
1 2150

"Matt" <ma*****@gmail.comwrote in message
news:11**********************@w5g2000hsg.googlegro ups.com...
I'm using classic ASP with an Access 2003 database, running on Win
2003 Server (IIS 6), trying to update a table and get the following
error:

[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement. - Err.Number:-2147217900 - SQL:UPDATE shipments SET
shipmentDescription='$0 - $

Here's my script:

dim SQL, connTemp, rsTemp

pIdShipment = request.Form("idShipment")
pShipmentDescription = request.form("shipmentDescription")
pPriceToAdd = request.form("priceToAdd")
pPercentageToAdd = request.form("percentageToAdd")
pShipmentTime = request.form("shipmentTime")

pQuantityFrom = request.form("quantityFrom")
pQuantityTo = request.form("quantityTo")

pWeightFrom = request.form("weightFrom")
pWeightTo = request.form("weightTo")

pPriceFrom = request.form("priceFrom")
pPriceTo = request.form("priceTo")

pIdZone = request.form("shippingZone")
pIdCustomerType = request.form("customerType")

' validate
if pShipmentDescription="" then
response.redirect "modifyShipmentForm.asp?
idShipment="&pIdShipment&"&message="& Server.Urlencode("Please enter a
valid shipment description")
end if

' update shipment in to db

SQL="UPDATE shipments SET shipmentDescription='"
&pShipmentDescription& "', priceToAdd=" &pPriceToAdd& ",
percentageToAdd=" &pPercentageToAdd& ", shipmentTime='"
&pShipmentTime& "', quantityFrom=" &pQuantityFrom& ", quantityTo="
&pQuantityTo& ", weightFrom=" &pWeightFrom& ", weightTo=" &pWeightTo&
", priceFrom=" &pPriceFrom& ", priceTo=" &pPriceTo& ",
idShippingZone=" &pIdZone& ", idCustomerType=" &pIdCustomerType& "
WHERE idShipment=" &pIdShipment

set connTemp = server.createObject("adodb.connection")

connTemp.Open DSN=MSC

set rsTemp=connTemp.execute(SQL)
The shipmentDescription and ShipmentTime columns are text fields,
everything else is number fields in Access.

Any ideas on what I'm doing wrong?
Do a Response.Write SQL and try to run the result against the database
directly, unless just looking at the result shows an obvious error in your
SQL.

Couple of other things: ODBC is a bad idea with Access. You should use the
native OLEDB provider:
http://databases.aspfaq.com/database...look-like.html

You should not be creating a recordset to perform an UPDATE operation.
http://databases.aspfaq.com/database...t-objects.html

Also, you should not plonk form values directly into SQL. You should use
parameters. They will protect you from SQL Injection, and remove the need
to delimit datatypes.

--
Mike Brind
Jun 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2524
by: RM | last post by:
Had VS .Net 2002 installed on W2k Server SP3 and supported a number of web sites. Installed VS .Net 2003 on Friday and now all web sites using .Net & MS ACCESS get this strange error upon open. ASP=/TestDotNet/AdoNet.aspx System.Data.OleDb.OleDbException: Unspecified error at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) at...
10
8682
by: Shawn | last post by:
JIT Debugging failed with the following error: Access is denied. JIT Debugging was initiated by the following account 'PLISKEN\ASPNET' I get this messag in a dialog window when I try to open an asp.net page. If I press OK then I get a page with this message: Server Application Unavailable The web application you are attempting to access...
9
3816
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. ...
6
6200
by: Mark | last post by:
Currently using MS Access 2000 and SQL Server Express. Using the current DAO OpenRecordset code listed below, however I keep getting the error message.... 3254: ODBC --Cannot lock all records The code below runs in a MS Access frontend while the table is linked using an ODBC connected to an SQL Server (backend). The table (located in...
2
19405
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's...
0
7408
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. ...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7548
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
5714
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...
1
5110
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...
0
4773
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...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
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
0
488
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.