Are your integer fields datatype "int" in your database? I think a similar error could occur if your integer fields were changed to varchar or a different non-integer based field.
Paul Alkema http://paulalkema.com/ -----Original Message----- From: Brad Wood [mailto:[email protected]] Sent: Thursday, June 24, 2010 9:57 PM To: cf-talk Subject: Re: Seriously PO'd - cfqueryparam and/or struct dereference flakes out It's a bit more code, but if you switch to having a cfargument tag for each parameter and enforce the type there, you can pass in your struct as an argument collection. You'll get a more meaningful error that way. Sent from my HTC on the Now Network from Sprint! ----- Reply message ----- From: "Marc Funaro" <[email protected]> Date: Thu, Jun 24, 2010 5:43 pm Subject: Seriously PO'd - cfqueryparam and/or struct dereference flakes out To: "cf-talk" <[email protected]> The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: "Invalid data '' for CFSQLTYPE CF_SQL_INTEGER." The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output="true" on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! <cffunction name="updateArticle" returntype="void" access="private" output="true"> <cfargument name="structArticle" required="true" type="Struct" hint="A structure containing all fields of an article, and the values to be saved."> <cfset var a = arguments.structArticle> <cfset var qUpdateArticle = ""> <!--- uncommenting this line gives me a valid integer on screen ---> <!--- <cfdump var="#a.articleId#"><cfabort> ---> <cfquery name="qUpdateArticle" datasource="#request.dsn#"> UPDATE Article SET categoryId = <cfqueryparam value="#a.categoryId#" cfsqltype="cf_sql_integer" />, title = <cfqueryparam value="#a.title#" cfsqltype="cf_sql_varchar" />, byLine = <cfqueryparam value="#a.byLine#" cfsqltype="cf_sql_varchar" />, imageId = <cfqueryparam value="#a.imageId#" cfsqltype="cf_sql_integer" />, imageCaption = <cfqueryparam value="#a.imageCaption#" cfsqltype="cf_sql_varchar" />, abstract = <cfqueryparam value="#a.abstract#" cfsqltype="cf_sql_varchar" />, body = <cfqueryparam value="#a.body#" cfsqltype="cf_sql_varchar" />, isLead = <cfqueryparam value="#a.isLead#" cfsqltype="cf_sql_bit" />, publishDateTime = <cfqueryparam value="#a.publishDateTime#" cfsqltype="cf_sql_timestamp" /> WHERE articleId = <cfqueryparam value="#a.articleId#" cfsqltype="cf_sql_integer" /> </cfquery> </cffunction> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334845 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

