Skip to main content
Known Participant
November 17, 2009
Question

Syntax error in UPDATE statement Please help

  • November 17, 2009
  • 1 reply
  • 474 views

I can't figure out what is wrong in my update statement. I did a cfdu

mp for the form.id just before this query and I get the form ID, so it's passing my ID, but why is my q

uery throwing this error?

error:

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
The error occurred in C:\Inetpub\wwwroot\website\admin\cms\babyAction.cfm: line 54
52 : baby_port.weight = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.weight#">,
53 : baby_port.TimeB = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.tob#">,
54 : WHERE baby_port.ID = <cfqueryparam value="#FORM.ID#" cfsqlType="CF_SQL_INTEGER">
55 : </cfquery>
56 : <cflocation url="babyPort.cfm?ID=#ID#" addtoken="no">

SQLSTATE  42000
SQL   UPDATE baby_port SET baby_port.dob = (param 1) , baby_port.Name = (param 2) , baby_port.Body = (param 3) , baby_port.weight = (param 4) , baby_port.TimeB = (param 5) , WHERE baby_port.ID = (param 6)
VENDORERRORCODE  -3503
DATASOURCE  mainDB
Resources:

Here is my query:

<cfquery datasource="#APPLICATION.dataSource#">
UPDATE baby_port
SET
baby_port.dob = <cfqueryparam cfsqltype="cf_sql_date" value="#form.edit1#">,
baby_port.Name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Name#">,
<cfif fileuploaded is true>
baby_port.MYFile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#uploadedfile#">,
</cfif>
baby_port.Body = <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form.PDSeditor#">,
baby_port.weight = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.weight#">,
baby_port.TimeB = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.tob#">,
WHERE baby_port.ID = <cfqueryparam value="#FORM.ID#" cfsqlType="CF_SQL_INTEGER">
</cfquery>

I don't understand what I'm doing wrong here. Can anyone help me? Is it more then something in this query? passing the wrong variable maybe? I can provide more code if needed.

thank you.

    This topic has been closed for replies.

    1 reply

    Inspiring
    November 17, 2009

    You have an extra comma after baby_port.TimeB