<cffunction name="delete" output="false" access="public"
returntype="void">
<cfargument name="Contacts" required="true"
type="samples.contact.Contact">
<cfset var qDelete="">
<cfquery name="qDelete" datasource="contacts">
delete from Contacts
where Contacts.contactId = <cfqueryparam
value="#arguments.Contacts.getcontactId()#"
cfsqltype="CF_SQL_INTEGER" />
</cfquery>
</cffunction>
<cffunction name="count" output="false" access="public"
returntype="samples.contact.Contact[]">
<cfargument name="id" required="false">
<cfargument name="param" required="false">
<cfset var qRead="">
<cfquery name="qRead" datasource="contacts">
select COUNT(*) as totalRecords
from Contacts
<cfif structKeyExists(arguments, "id")>
where contactId = <cfqueryparam cfsqltype="CF_SQL_INTEGER"
value="#arguments.id#" />
<cfelseif structKeyExists(arguments, "param")>
<!--- Adjust this WHERE clause based on how to filter. --->
<!--- For example, to filter by LastName, --->
<!--- pass in what you want to filter by in
<!--- the param attribute of the function --->
<!--- and change "where fieldname" to --->
<!--- "where LastName". --->
where fieldname LIKE "%<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="#arguments.param#"/>%
</cfif>
</cfquery>
<cfreturn qRead.totalRecords>
</cffunction>
</cfcomponent>
--->
Example application
57
Need help?
Do you have a question about the COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 and is the answer not in the manual?
Questions and answers