Skip to main content
Participating Frequently
July 14, 2006
Question

Unsupported Cast Excpetion:

  • July 14, 2006
  • 1 reply
  • 2056 views
Using the following query statement:

<cfquery name="AllEvents" dbtype="query">
SELECT *
FROM AllEvents
ORDER BY Start_Time
<cfif EventFlag Eq 1>
, EventDesc
</cfif>
</cfquery>

We get the following error:

Query Of Queries runtime error. Query Of Queries runtime error.
Unsupported Cast Excpetion: Casting to type "NULL" is unsupported.

It appears to be related to our use of tostring. This worked fine with CF6.1MX, but when we changed to CF7, this error occurred.
    This topic has been closed for replies.

    1 reply

    Inspiring
    July 14, 2006
    Is the query AllEvents built dynamically? If it is, I may know what the problem is.
    BillWITAuthor
    Participating Frequently
    July 14, 2006
    Yes.

    <cfset AllEvents = QueryNew("Contact_ID,Customer_ID,Show_ON_Cal,Label_ID,Label_Text...........etc
    Inspiring
    July 17, 2006
    I was having the same issue and ran into a post that gave the following information:

    Dynamically built queries (queryNew(), querySetCell() etc)
    don't take on the right types for QoQ, which seems to be the only typed part
    of CF. This has caused many people grief.
    Appending the integer value to an empty string, before inserting it in query row,
    seems to make a subsequent query of queries work! Bizzarre. Blows my mind! I don't really know why!

    <!---Bug Fix--->
    <CFSET ElementID = "">
    <CFSET ElementID = ElementID & "your value"

    This solved my problem in some instances. However, I still ran into problems where some of the integer values were still null.
    I was able to set these to zero instead and Coldfusion than recognized the field as numeric.

    Hope this helps