|
 |
asp_web_howto thread: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE - statement.
Message #1 by "Beasley, Shawn" <SBeasley@S...> on Thu, 25 Oct 2001 10:55:43 -0500
|
|
I am getting the follwoing error message:
Technical Information (for support personnel)
* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/OnlineStore/html/check_out.asp, line 20
It pertains to the following code (any help regarding this issue is greatly
appreciated!):
<%
Option Explicit
Dim Conn
Dim RSOrderTotal
Dim RSTaxRate
If IsEmpty(Session("CustomerID")) Then
Response.Redirect "./shopping_cart.asp"
End If
If Not IsEmpty(Request.Form("OK")) Then
set conn = server.createobject ("adodb.connection")
conn.open "MyStore"
Set RSOrderTotal = Conn.Execute("Select Sum(ItemTotal) " _
& "as TheTotal From OSCustomerOrders Where " _
& "CustomerID = " & Session("CustomerID"))
If IsNull(RSOrderTotal("TheTotal")) Then
Response.Redirect "./shopping_cart.asp"
End If
Set RSTaxRate = Conn.Execute("Select TaxRate From OSTaxRates " _
& "Where Location = '" & Request.Form("BillingState") & "'")
*******************************************************
* The following line is line 20 - the error line *
*******************************************************
Conn.Execute "Update OSCustomers Set" _
& "BillingName = '" & Request.Form("BillingName") & "', " _
& "BillingEmailAddress = '" &
Request.Form("BillingEmailAddress") & "', " _
& "BillingAddress = '" & Request.Form("BillingAddress") &
"', " _
& "BillingCity = '" & Request.Form("BillingCity") & "', " _
& "BillingState = '" & Request.Form("BillingState") & "', "
_
& "BillingZipCode = '" & Request.Form("BillingZipCode") &
"', " _
& "ShippingName = '" & Request.Form("ShippingName") & "', "
_
& "ShippingEmailAddress = '" &
Request.Form("ShippingEmailAddress") & "', " _
& "ShippingAddress = '" & Request.Form("ShippingAddress") &
"', " _
& "ShippingCity = '" & Request.Form("ShippingCity") & "', "
_
& "ShippingState = '" & Request.Form("ShippingState") & "',
" _
& "ShippingZipCode = '" & Request.Form("ShippingZipCode") &
"', " _
& "OrderSubTotal = " & RSOrderTotal("TheTotal") & ", " _
& "OrderTax = " & (RSOrderTotal("TheTotal") *
RSTaxRate("TaxRate")) _
& " Where CustomerID = " & Session("CustomerID")
Response.Redirect "./billing_info.asp"
End If
%>
Message #2 by "Morgan, Rob" <Rob.Morgan@o...> on Thu, 25 Oct 2001 14:09:51 -0400
|
|
take out 'Conn.Execute' and put in 'SQL ='.
Put in a response.write SQL at the end.
Run the page and read the sql statement your trying to run. The problem
should become obvious.
-----Original Message-----
From: Beasley, Shawn [mailto:SBeasley@S...]
Sent: Thursday, October 25, 2001 11:56 AM
To: ASP Web HowTo
Subject: [asp_web_howto] [Microsoft][ODBC Microsoft Access Driver]
Syntax error in UPDATE statement.
I am getting the follwoing error message:
Technical Information (for support personnel)
* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/OnlineStore/html/check_out.asp, line 20
It pertains to the following code (any help regarding this issue is greatly
appreciated!):
<%
Option Explicit
Dim Conn
Dim RSOrderTotal
Dim RSTaxRate
If IsEmpty(Session("CustomerID")) Then
Response.Redirect "./shopping_cart.asp"
End If
If Not IsEmpty(Request.Form("OK")) Then
set conn = server.createobject ("adodb.connection")
conn.open "MyStore"
Set RSOrderTotal = Conn.Execute("Select Sum(ItemTotal) " _
& "as TheTotal From OSCustomerOrders Where " _
& "CustomerID = " & Session("CustomerID"))
If IsNull(RSOrderTotal("TheTotal")) Then
Response.Redirect "./shopping_cart.asp"
End If
Set RSTaxRate = Conn.Execute("Select TaxRate From OSTaxRates " _
& "Where Location = '" & Request.Form("BillingState") & "'")
*******************************************************
* The following line is line 20 - the error line *
*******************************************************
Conn.Execute "Update OSCustomers Set" _
& "BillingName = '" & Request.Form("BillingName") & "', " _
& "BillingEmailAddress = '" &
Request.Form("BillingEmailAddress") & "', " _
& "BillingAddress = '" & Request.Form("BillingAddress") &
"', " _
& "BillingCity = '" & Request.Form("BillingCity") & "', " _
& "BillingState = '" & Request.Form("BillingState") & "', "
_
& "BillingZipCode = '" & Request.Form("BillingZipCode") &
"', " _
& "ShippingName = '" & Request.Form("ShippingName") & "', "
_
& "ShippingEmailAddress = '" &
Request.Form("ShippingEmailAddress") & "', " _
& "ShippingAddress = '" & Request.Form("ShippingAddress") &
"', " _
& "ShippingCity = '" & Request.Form("ShippingCity") & "', "
_
& "ShippingState = '" & Request.Form("ShippingState") & "',
" _
& "ShippingZipCode = '" & Request.Form("ShippingZipCode") &
"', " _
& "OrderSubTotal = " & RSOrderTotal("TheTotal") & ", " _
& "OrderTax = " & (RSOrderTotal("TheTotal") *
RSTaxRate("TaxRate")) _
& " Where CustomerID = " & Session("CustomerID")
Response.Redirect "./billing_info.asp"
End If
%>
Message #3 by "Beasley, Shawn" <SBeasley@S...> on Thu, 25 Oct 2001 16:15:01 -0500
|
|
Thanks,
I will give this a try.
-----Original Message-----
From: Morgan, Rob [mailto:Rob.Morgan@o...]
Sent: Thursday, October 25, 2001 1:10 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: [Microsoft][ODBC Microsoft Access Driver]
Syn tax error in UPDATE statement.
take out 'Conn.Execute' and put in 'SQL ='.
Put in a response.write SQL at the end.
Run the page and read the sql statement your trying to run. The problem
should become obvious.
Message #4 by "Ken Schaefer" <ken@a...> on Fri, 26 Oct 2001 18:29:27 +1000
|
|
Response.Write() your SQL statement should point out your error straight
away - you are missing spaces in your SQL statement...
<%
strSQL = "UPDATE....."
Response.Write(strSQL)
Response.End
%>
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Beasley, Shawn" <SBeasley@S...>
Subject: [asp_web_howto] [Microsoft][ODBC Microsoft Access Driver] Syntax
error in UPDATE statement.
: I am getting the follwoing error message:
:
: Technical Information (for support personnel)
: * Error Type:
: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
: /OnlineStore/html/check_out.asp, line 20
: It pertains to the following code (any help regarding this issue is
greatly
: appreciated!):
:
: <%
: Option Explicit
: Dim Conn
: Dim RSOrderTotal
: Dim RSTaxRate
:
: If IsEmpty(Session("CustomerID")) Then
: Response.Redirect "./shopping_cart.asp"
: End If
:
: If Not IsEmpty(Request.Form("OK")) Then
: set conn = server.createobject ("adodb.connection")
: conn.open "MyStore"
: Set RSOrderTotal = Conn.Execute("Select Sum(ItemTotal) " _
: & "as TheTotal From OSCustomerOrders Where " _
: & "CustomerID = " & Session("CustomerID"))
: If IsNull(RSOrderTotal("TheTotal")) Then
: Response.Redirect "./shopping_cart.asp"
: End If
:
: Set RSTaxRate = Conn.Execute("Select TaxRate From OSTaxRates " _
: & "Where Location = '" & Request.Form("BillingState") & "'")
:
|
|
 |