Skip to main content
nikos101
Inspiring
June 19, 2009
Question

Unable to invoke CFC - Variable Q is undefined

  • June 19, 2009
  • 1 reply
  • 1723 views

I am using Ms sql and if I do this in the query editor :

select dbo.GetBranchNoFromIP('9.4.1.42')

I get a good result,

however in a remote object if I do the following:

<cffunction name="getCode" access="remote" returntype="string">       
        <cfargument name="localIP" type="string" required="yes">      

       
        <cfstoredproc  procedure="GetBranchNoFromIP"   datasource="#datasource#" returncode="true">
       
            <cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR" value="9.4.1.42">
            <cfprocresult name="q">

       
        </cfstoredproc>   
       
       
        <cfset flash.result=q>   
        <cfreturn flash.result>                   
    </cffunction>  

I get an error sayuing

faultCode:Server.Processing faultString:'Unable to invoke CFC - Variable Q is undefined.' faultDetail:''

ANy ideas what could be wrong?


This topic has been closed for replies.

1 reply

Inspiring
June 19, 2009

I would troubleshoot this by putting this code into a .cfm page.

<cfset x = StructClear(variables)>

<cfstoredproc  procedure="GetBranchNoFromIP"   datasource="#datasource#" returncode="true" result="abc">
<cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR" value="9.4.1.42">
<cfprocresult name="q">

</cfstoredproc>  

<cfdump var ="#variables#">

Your function has a couple of minor errors that may or may not be significant.  Variables flash and q were not "var"'d to make them local to the function.

nikos101
nikos101Author
Inspiring
June 22, 2009

Many thanks Dan your advice was very much appreciated.

I tried the following:#

<cfset x = StructClear(variables)>
<cfstoredproc  procedure="GetBranchNoFromIP"   datasource="traci" returncode="true" result="abc">
  <cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR" value="9.4.1.42">
  <cfprocresult name="q">
</cfstoredproc>
<cfdump var ="#variables#">

the out put I got was the following:

struct
ABC
struct
CACHEDfalse
EXECUTIONTIME31
STATUSCODE0
XYES

What can I do next?

nikos101
nikos101Author
Inspiring
June 22, 2009

I'm just gonna use the result tag thanks, it works fine