Have you looked at the datasource to see if there is an issue with the data?
Since you said it worked fine for months.

-----Original Message-----
From: Marc Funaro [mailto:[email protected]] 
Sent: Thursday, June 24, 2010 3:43 PM
To: cf-talk
Subject: Seriously PO'd - cfqueryparam and/or struct dereference flakes out


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:334846
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to