Skip to main content
Known Participant
November 9, 2010
Question

Error Executing Database Query. (Please help)

  • November 9, 2010
  • 1 reply
  • 909 views

I can't get this query to work properly. I have gone over it so many times.. I can't count, I don't get why it's throwing an error. Here is my code, and followed by the error:

My update query:

<cfquery name="UpdateDetails" datasource="#APPLICATION.dataSource#">
UPDATE books234
SET
books234.title=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.title#">,
books234.info=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.info#">,
books234.statement=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.statement#">,
<cfif fileuploaded is true>
books234.MYFile=<cfqueryparam cfsqltype="cf_sql_varchar" value="#uploadedfile#">,
</cfif>
books234.links=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.links#">,
books234.ordNum=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.ordNum#">
WHERE books234.ID = <cfqueryparam value="#form.ID#" cfsqlType="CF_SQL_INTEGER">
</cfquery>
<cflocation url="bookView.cfm?ID=#Form.ID#" addtoken="no">

Here is my error:

Error  Executing Database Query.

[Macromedia][SequeLink JDBC  Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]Invalid precision  value
The  error occurred in C:\websites\209689jh6\slideAction.cfm: line  455
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 442
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 390
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 1
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 455
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 442
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 390
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 1
453 : books234.links=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.links#">,
454 : books234.ordNum=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.ordNum#">
455 : WHERE books234.ID = <cfqueryparam value="#form.ID#" cfsqlType="CF_SQL_INTEGER">
456 : </cfquery>
457 : <cflocation url="bookView.cfm?ID=#Form.ID#" addtoken="no">

Can anyone see what I did wrong here? It's not like it's a sophisticated query. I write these all the time.

Thank you.

    This topic has been closed for replies.

    1 reply

    November 10, 2010

    Does it work without using cfqueryparam in the WHERE statement?  Are you sure the type CF_SQL_INTEGER is correct?  Is the value of form.ID really an integer?

    Cheers