|
 |
asp_web_howto thread: UPDATE Problem
Message #1 by "Paul David Jacobs" <jacobspd@g...> on Thu, 3 Oct 2002 16:23:12 -0500
|
|
Hi all,
I am having trouble with this UPDATE page giving me the following error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
/gsii/intranet/mecanica_update.asp, line 30
Here is the code:
<%
Dim strSQL, CDate, CUnitName, CUnitNum, CKilometers, CFactura
Dim CNextService, CPoliza, CTypeRepair, CWorkshop, CChofer,
CObservaciones, CCosto
Dim CFormPay, CIDent, dbDir
set DbConn = Server.CreateObject("ADODB.Connection")
DbConn.Open "DSN=sii"
CDate = Trim(Request.Form("txtDate"))
CUnitName = Trim(Request.Form("txtUnit"))
CUnitNum = Trim(Request.Form("txtUnitNum"))
CKilometers = Trim(Request.Form("txtKilometers"))
CFactura = Trim(Request.Form("txtFactura"))
CNextService = Trim(Request.Form("txtProxServ"))
CPoliza = Trim(Request.Form("txtPoliza"))
CTypeRepair = Trim(Request.Form("txtType"))
CWorkShop = Trim(Request.Form("txtWorkshop"))
CChofer = Trim(Request.Form("txtChofer"))
CObservaciones = Trim(Request.Form("txtObservations"))
CCosto = Trim(Request.Form("txtCost"))
CFormPay = Trim(Request.Form("txtFormPay"))
CIDent = Request.Form("mecID")
strSQL = "UPDATE Contacts SET" _
& " [MecDate] = '" & CDate & "'," _
& " [UnitName] = '" & CUnitName & "'," _
& " [UnitNum] = '" & CUnitNum & "'," _
& " [Kilometers] = '" & CKilometers & "'," _
& " [Factura] = '" & CFactura & "'," _
& " [NextService] = '" & CNextService & "'," _
& " [Poliza] = '" & CPoliza & "'," _
& " [TypeRepair] = '" & CTypeRepair & "'," _
& " [Workshop] = '" & CWorkshop & "'," _
& " [Chofer] = '" & CChofer & "'," _
& " [Observations] = '" & CObservaciones & "'," _
& " [Costo] = '" & CCosto & "'," _
& " [FormPay] = '" & CFormPay & "'," _
& " WHERE Ident = " & CIDent &";"
SET rs = DbConn.Execute(strSQL)
%>
The above error message refers to the line just about
SET rs = DbConn.Execute(strSQL)
It is probably something obvious within the statement. but I have been
staring at it for so long that I could easily miss the source of the
problem.
Would appreciate anybodies help with this problem
With many thanks,
Paul Jacobs
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 4 Oct 2002 11:45:57 +1000
|
|
Couple of things:
a) Replace:
SET rs = DbConn.Execute(strSQL)
with
Response.Write(strSQL)
Response.End
and look at what is being output to the screen. Post that output to the list
so that we can see what is actually being sent to the database
b) You don't need a recordset when executing an UPDATE statement - no
records are being returned. All you need is:
DbConn.Execute(strSQL)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Paul David Jacobs" <jacobspd@g...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Friday, October 04, 2002 7:23 AM
Subject: [asp_web_howto] UPDATE Problem
: Hi all,
:
: I am having trouble with this UPDATE page giving me the following error:
:
: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
: statement.
: /gsii/intranet/mecanica_update.asp, line 30
:
: Here is the code:
:
: <%
: Dim strSQL, CDate, CUnitName, CUnitNum, CKilometers, CFactura
: Dim CNextService, CPoliza, CTypeRepair, CWorkshop, CChofer,
: CObservaciones, CCosto
: Dim CFormPay, CIDent, dbDir
:
: set DbConn = Server.CreateObject("ADODB.Connection")
: DbConn.Open "DSN=sii"
:
: CDate = Trim(Request.Form("txtDate"))
: CUnitName = Trim(Request.Form("txtUnit"))
: CUnitNum = Trim(Request.Form("txtUnitNum"))
: CKilometers = Trim(Request.Form("txtKilometers"))
: CFactura = Trim(Request.Form("txtFactura"))
: CNextService = Trim(Request.Form("txtProxServ"))
: CPoliza = Trim(Request.Form("txtPoliza"))
: CTypeRepair = Trim(Request.Form("txtType"))
: CWorkShop = Trim(Request.Form("txtWorkshop"))
: CChofer = Trim(Request.Form("txtChofer"))
: CObservaciones = Trim(Request.Form("txtObservations"))
: CCosto = Trim(Request.Form("txtCost"))
: CFormPay = Trim(Request.Form("txtFormPay"))
: CIDent = Request.Form("mecID")
:
: strSQL = "UPDATE Contacts SET" _
: & " [MecDate] = '" & CDate & "'," _
: & " [UnitName] = '" & CUnitName & "'," _
: & " [UnitNum] = '" & CUnitNum & "'," _
: & " [Kilometers] = '" & CKilometers & "'," _
: & " [Factura] = '" & CFactura & "'," _
: & " [NextService] = '" & CNextService & "'," _
: & " [Poliza] = '" & CPoliza & "'," _
: & " [TypeRepair] = '" & CTypeRepair & "'," _
: & " [Workshop] = '" & CWorkshop & "'," _
: & " [Chofer] = '" & CChofer & "'," _
: & " [Observations] = '" & CObservaciones & "'," _
: & " [Costo] = '" & CCosto & "'," _
: & " [FormPay] = '" & CFormPay & "'," _
: & " WHERE Ident = " & CIDent &";"
:
: SET rs = DbConn.Execute(strSQL)
: %>
:
: The above error message refers to the line just about
:
: SET rs = DbConn.Execute(strSQL)
:
: It is probably something obvious within the statement. but I have been
: staring at it for so long that I could easily miss the source of the
: problem.
:
: Would appreciate anybodies help with this problem
:
: With many thanks,
:
: Paul Jacobs
:
:
:
: ---
:
: Improve your web design skills with these new books from Glasshaus.
:
: Usable Web Menus
: http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
: r-20
: Constructing Accessible Web Sites
: http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
: r-20
: Practical JavaScript for the Usable Web
: http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
: r-20
Message #3 by "Paul David Jacobs" <jacobspd@g...> on Fri, 4 Oct 2002 07:17:16 -0500
|
|
Ken,
After putting in your suggest code this was the resulting SQL statement
UPDATE Mechanics SET [MecDate] = '3/5/2002', [UnitName] = 'LIMOUSIN',
[UnitNum] = '25', [Kilometers] = '', [Factura] = '7494', [NextService]
'', [Poliza] = '', [TypeRepair] = 'LIQUIDO DE INYECTORES, FILTRO DE
AIRE, LAVAR SISTEMA DE ACELERACION, VERIFICACION', [Workshop]
'RECONSTRUCCIONES AUTOMOTRICES...', [Chofer] = 'SALVADOR',
[Observations] = '', [Costo] = '$1,316.75', [FormPay] = 'CREDITO', WHERE
Ident = 35;
Let me know if you can see a problem
Many thanks,
Paul D. Jacobs
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: Thursday, October 03, 2002 8:46 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: UPDATE Problem
Couple of things:
a) Replace:
SET rs = DbConn.Execute(strSQL)
with
Response.Write(strSQL)
Response.End
and look at what is being output to the screen. Post that output to the
list
so that we can see what is actually being sent to the database
b) You don't need a recordset when executing an UPDATE statement - no
records are being returned. All you need is:
DbConn.Execute(strSQL)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Paul David Jacobs" <jacobspd@g...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Friday, October 04, 2002 7:23 AM
Subject: [asp_web_howto] UPDATE Problem
: Hi all,
:
: I am having trouble with this UPDATE page giving me the following
error:
:
: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
: statement.
: /gsii/intranet/mecanica_update.asp, line 30
:
: Here is the code:
:
: <%
: Dim strSQL, CDate, CUnitName, CUnitNum, CKilometers, CFactura
: Dim CNextService, CPoliza, CTypeRepair, CWorkshop, CChofer,
: CObservaciones, CCosto
: Dim CFormPay, CIDent, dbDir
:
: set DbConn = Server.CreateObject("ADODB.Connection")
: DbConn.Open "DSN=sii"
:
: CDate = Trim(Request.Form("txtDate"))
: CUnitName = Trim(Request.Form("txtUnit"))
: CUnitNum = Trim(Request.Form("txtUnitNum"))
: CKilometers = Trim(Request.Form("txtKilometers"))
: CFactura = Trim(Request.Form("txtFactura"))
: CNextService = Trim(Request.Form("txtProxServ"))
: CPoliza = Trim(Request.Form("txtPoliza"))
: CTypeRepair = Trim(Request.Form("txtType"))
: CWorkShop = Trim(Request.Form("txtWorkshop"))
: CChofer = Trim(Request.Form("txtChofer"))
: CObservaciones = Trim(Request.Form("txtObservations"))
: CCosto = Trim(Request.Form("txtCost"))
: CFormPay = Trim(Request.Form("txtFormPay"))
: CIDent = Request.Form("mecID")
:
: strSQL = "UPDATE Contacts SET" _
: & " [MecDate] = '" & CDate & "'," _
: & " [UnitName] = '" & CUnitName & "'," _
: & " [UnitNum] = '" & CUnitNum & "'," _
: & " [Kilometers] = '" & CKilometers & "'," _
: & " [Factura] = '" & CFactura & "'," _
: & " [NextService] = '" & CNextService & "'," _
: & " [Poliza] = '" & CPoliza & "'," _
: & " [TypeRepair] = '" & CTypeRepair & "'," _
: & " [Workshop] = '" & CWorkshop & "'," _
: & " [Chofer] = '" & CChofer & "'," _
: & " [Observations] = '" & CObservaciones & "'," _
: & " [Costo] = '" & CCosto & "'," _
: & " [FormPay] = '" & CFormPay & "'," _
: & " WHERE Ident = " & CIDent &";"
:
: SET rs = DbConn.Execute(strSQL)
: %>
:
: The above error message refers to the line just about
:
: SET rs = DbConn.Execute(strSQL)
:
: It is probably something obvious within the statement. but I have been
: staring at it for so long that I could easily miss the source of the
: problem.
:
: Would appreciate anybodies help with this problem
:
: With many thanks,
:
: Paul Jacobs
:
:
:
: ---
:
: Improve your web design skills with these new books from Glasshaus.
:
: Usable Web Menus
:
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
: r-20
: Constructing Accessible Web Sites
:
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
: r-20
: Practical JavaScript for the Usable Web
:
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
: r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #4 by "Ken Schaefer" <ken@a...> on Tue, 8 Oct 2002 11:15:21 +1000
|
|
The error is just before the WHERE clause, you have:
[FormPay] = 'CREDITO', WHERE
notice there is an extra "," before WHERE?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Paul David Jacobs" <jacobspd@g...>
Subject: [asp_web_howto] Re: UPDATE Problem
: Ken,
:
: After putting in your suggest code this was the resulting SQL statement
:
: UPDATE Mechanics SET [MecDate] = '3/5/2002', [UnitName] = 'LIMOUSIN',
: [UnitNum] = '25', [Kilometers] = '', [Factura] = '7494', [NextService]
: '', [Poliza] = '', [TypeRepair] = 'LIQUIDO DE INYECTORES, FILTRO DE
: AIRE, LAVAR SISTEMA DE ACELERACION, VERIFICACION', [Workshop]
: 'RECONSTRUCCIONES AUTOMOTRICES...', [Chofer] = 'SALVADOR',
: [Observations] = '', [Costo] = '$1,316.75', [FormPay] = 'CREDITO', WHERE
: Ident = 35;
:
: Let me know if you can see a problem
|
|
 |