View comments | RSS feed
Contents > Developing ColdFusion MX Applications > Building and Using ColdFusion Components > Building ColdFusion components > Defining component methods PreviousNext

Defining component methods

You define component methods using cffunction tags, as the following example shows, which defines a getEmp method:

<cffunction name="getEmp" displayname="Get Employee" access="remote">
    <cfquery name="empQuery" datasource="ExampleApps" dbtype="ODBC" >
       SELECT FIRSTNAME, LASTNAME, EMAIL
       FROM tblEmployees
    </cfquery>
    <cfreturn empQuery>
</cffunction>

Because component methods are ColdFusion functions, most of their features and coding techniques are identical to those of user defined functions. For more information on using the cffunction tag to create functions, see Writing and Calling User-Defined Functions.

Tip: To improve performance, avoid using the cfparam tag in CFC methods. Instead, use the cfset tag or CFScript assignment statements.

The following cffunction tag attributes are used only for CFCs:

For detailed reference information on the cffunction tag, see CFML Reference.


Contents > Developing ColdFusion MX Applications > Building and Using ColdFusion Components > Building ColdFusion components > Defining component methods PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


jshaffner said on Jun 22, 2004 at 7:25 AM :
If one should avoid using cfparam in methods to improve performance, when is it okay or necessary to use cfparam?
ASandstrom said on Jun 22, 2004 at 8:15 AM :
It is highly unlikely that you would notice any performance degradation when you use cfparam in a method. This note will not appear in the next version of the documentation.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/buildi37.htm