Get rid of the "*" in the SELECT *. Using CFQueryParam causes the structure to be cached. Then, if the underlying DB changes, the structure no longer applies, but since CF sees it as the same thing, weirdness ensues. In general get rid of all SELECT *'s in your code. They are evil and cause headaches like this.
...................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -----Original Message----- From: Nicholas Vacek [mailto:[EMAIL PROTECTED] Sent: Monday, November 26, 2007 3:58 PM To: CF-Talk Subject: error caused by cfqueryparam inside cfif Can anybody help me figure out this error? I'm struggling with a really confusing error. It occurs when I put a cfqueryparam tag nested inside a cfif tag. For example, here's a query: <cfquery name="getRecords" datasource="#Variables.datasource#"> SELECT * FROM TableName WHERE 0=0 <cfif true> AND fieldName = <cfqueryparam value="#value#" cfsqltype="cf_sql_integer" /> </cfif> </cfquery> The relevant lines of code that causes the error: <cfif true> AND fieldName = <cfqueryparam value="#value#" cfsqltype="cf_sql_integer" /> </cfif> However, if I leave off the cfif wrapper, the following works: AND fieldName = <cfqueryparam value="#value#" cfsqltype="cf_sql_integer" /> Alternatively, if I don't use a cfqueryparam, then this code works without errors too: <cfif true> AND fieldName = #value# </cfif> Here's the error message: The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code When I wrap the query it in a try-catch and dump the catch scope, I see an empty error - no message, no stackTrace, nothing. More interesting data: This error only occurs on CF8. And only when the code is located in a .cfc file. It doesn't happen if the query is on a ...cfm page, or using CF7. What's going on?!? -- Nicholas Vacek Vivid Image - Programmer 320-587-8974 ext. 111 [EMAIL PROTECTED] http://www.vimm.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293831 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4