Question
my fisrt cfc
I tried to learn to use cf component by creating a simple
cfc.
All I want to do within the cfc is to provide 1 query so within the application this query doesn't have to be created many times.
I created a getFrmTypes.cfc this way:
<!--- getFrmTypes.cfc --->
<CFCOMPONENT>
<CFFUNCTION Name="FrmTypes" ReturnType="query">
<cfquery name="getTypes" datasource="MyDB">
Select * from TblForms order by FormID Asc
</cfquery>
</CFFUNCTION>
</CFCOMPONENT>
Then on the CF template that is calling this cfc I wrote:
<CFINVOKE Component="getFrmTypes" Method="FrmTypes" ReturnVariable="FormTypesQuery">
When I run this template I got this error:
The value returned from function FrmTypes() is not of type query.
If the component name is specified as a return type, the reason for this error might be that a definition file for such component cannot be found or is not accessible.
line 12
12 : <CFINVOKE Component="getFrmTypes" Method="FrmTypes" ReturnVariable="FormTypesQuery">
13 :
14 : <table border="0">
I don't understand what is the meanng of this error and how can I make correction, please help.
All I want to do within the cfc is to provide 1 query so within the application this query doesn't have to be created many times.
I created a getFrmTypes.cfc this way:
<!--- getFrmTypes.cfc --->
<CFCOMPONENT>
<CFFUNCTION Name="FrmTypes" ReturnType="query">
<cfquery name="getTypes" datasource="MyDB">
Select * from TblForms order by FormID Asc
</cfquery>
</CFFUNCTION>
</CFCOMPONENT>
Then on the CF template that is calling this cfc I wrote:
<CFINVOKE Component="getFrmTypes" Method="FrmTypes" ReturnVariable="FormTypesQuery">
When I run this template I got this error:
The value returned from function FrmTypes() is not of type query.
If the component name is specified as a return type, the reason for this error might be that a definition file for such component cannot be found or is not accessible.
line 12
12 : <CFINVOKE Component="getFrmTypes" Method="FrmTypes" ReturnVariable="FormTypesQuery">
13 :
14 : <table border="0">
I don't understand what is the meanng of this error and how can I make correction, please help.
