Skip to main content
WolfShade
Legend
February 18, 2011
Question

CF9, no hotfix, VendorErrorCode 8114, cfprocresult error converting data type

  • February 18, 2011
  • 1 reply
  • 1168 views

Hello, everyone.

I've got an issue that really has me scratching my head.  Not sure where the issue lies, but I'll explain as best I can.

Basically, I _think_ I'm being told that one of the fields in the recordset is not being converted.

On one page, I make the following CFINVOKE:

<cfinvoke component="components.header" method="content_single" returnvariable="resultset"
     dbdsn="#request.db_dsn#" dbusr="#request.db_username#" dbpwd="#request.db_password#">
     <cfinvokeargument name="table" value="#url.table#">
     <cfif isDefined("url.thisNav") AND len(trim(url.thisNav)) gt 0><cfinvokeargument name="pt" value="#trim(url.thisNav)#"></cfif>
     <cfif isDefined("url.id") AND val(url.id) gt 0><cfinvokeargument name="id" value="#val(url.id)#"></cfif>
     <cfif isDefined("url.section") AND len(trim(url.section)) gt 0><cfinvokeargument name="section" value="#trim(url.section)#"></cfif>
</cfinvoke>

Within a CFCOMPONENT in header.cfc, I have the following:

<cffunction name="content_single" access="public">
         <cfargument name="dbdsn" required="yes">
         <cfargument name="dbusr" required="yes">
         <cfargument name="dbpwd" required="yes">
     <cfargument name="pt" required="no">
     <cfargument name="id" required="no">
     <cfargument name="section" required="no">
     <cfargument name="table" required="yes">
     <cfstoredproc procedure="SRT_sp_#lcase(url.table)#_contents_single" datasource="#dbdsn#"
             username="#dbusr#" password="#dbpwd#"
            result="query_result">
        <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@table" value="#lcase(table)#" maxlength="30">
<cfif isDefined("pt") AND len(trim(pt)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@pt" value="#ucase(pt)#" maxlength="12" null="no"></cfif>
<cfif isDefined("id") AND val(id) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="@id" value="#val(id)#" maxlength="10" null="no"></cfif>
<cfif isDefined("section") AND len(trim(section)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@section" value="#trim(replace(lcase(section),'_',' ','all'))#" maxlength="20" null="no"></cfif>
            <cfprocresult name="returned_result">
        </cfstoredproc>
          <cfreturn returned_result>
</cffunction>

Instead of the results I expect, I get the following error:

Error  Executing Database Query.

[Macromedia][SQLServer JDBC  Driver][SQLServer]Error converting data type varchar to int.
The  error occurred in E:\xxxxxxxx\xxxxxxx\xxxx\components\header.cfc: line  17
Called from
E:\xxxxxxxx\xxxxxxx\xxxx\content_view.cfm:  line 24
Called from
E:\xxxxxxxx\xxxxxxx\xxxx\components\header.cfc: line 17
Called  from
E:\xxxxxxxx\xxxxxxx\xxxx\content_view.cfm: line  24
15 :     <cfif isDefined("id") AND val(id) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="@id" value="#val(id)#" maxlength="10" null="no"></cfif>
16 :     <cfif isDefined("section") AND len(trim(section)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@section" value="#trim(replace(lcase(section),'_',' ','all'))#" maxlength="20" null="no"></cfif>
17 :             <cfprocresult name="returned_result">
18 :         </cfstoredproc>
19 :           <cfreturn returned_result>
    This topic has been closed for replies.

    1 reply

    Inspiring
    February 18, 2011

    Does the procedure work when called outside of CF?

    <cfif isDefined("pt") AND len(trim(pt)) gt

    0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR"

    variable="@pt" value="#ucase(pt)#" maxlength="12"

    null="no"></cfif>

    Also, parameters are passed by position. So you need to supply all of them and in the same order as the base procedure.

    WolfShade
    WolfShadeAuthor
    Legend
    February 21, 2011

    The SP that is called does work in Query Analyzer.

    -==cfSearching==- wrote:

    Also, parameters are passed by position. So you need to supply all of them and in the same order as the base procedure.

    The SP defaults the three variables to either 0 or '', depending.  But you are saying that the part of the cfprocparam variable="@pt" doesn't associate with the corresponding @pt in the SP?

    ^_^

    WolfShade
    WolfShadeAuthor
    Legend
    February 21, 2011

    Co-worker just pointed out that variable should actually be dbvarname.  I made this change, and I'm still getting the same error.  Seems like the issue is in what is being returned, not what is being submit.  The error message specifically points to the CFPROCRESULT tag.

    ^_^