Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Syntax error in UPDATE statement Please help

Community Beginner ,
Nov 17, 2009 Nov 17, 2009

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.

439
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 17, 2009 Nov 17, 2009
LATEST

You have an extra comma after baby_port.TimeB

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources