MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Use Manual page 55

Table of Contents

Advertisement

ArrayAppend(ret, obj);
</cfscript>
</cfloop>
<cfreturn ret>
</cffunction>
<cffunction name="create" output="false" access="public"
returntype="void">
<cfargument name="Contacts" required="true"
type="samples.contact.Contact">
<cfset var qCreate="">
<cfset var localFirstName=arguments.Contacts.getFirstName()>
<cfset var localLastName=arguments.Contacts.getLastName()>
<cfset var localAddress=arguments.Contacts.getAddress()>
<cfset var localCity=arguments.Contacts.getCity()>
<cfset var localState=arguments.Contacts.getState()>
<cfset var localZip=arguments.Contacts.getZip()>
<cfset var localphone=arguments.Contacts.getphone()>
<cftransaction isolation="read_committed">
<cfquery name="qCreate" datasource="contacts">
insert into Contacts(FirstName, LastName, Address, City,
State, Zip, phone)
values (
<cfqueryparam value="#localFirstName#"
cfsqltype="CF_SQL_VARCHAR" />,
<cfqueryparam value="#localLastName#"
cfsqltype="CF_SQL_VARCHAR" />,
<cfqueryparam value="#localAddress#" cfsqltype=
"CF_SQL_VARCHAR" />,
<cfqueryparam value="#localCity#" cfsqltype="CF_SQL_VARCHAR" />,
<cfqueryparam value="#localState#" cfsqltype=
"CF_SQL_VARCHAR" />,
<cfqueryparam value="#localZip#" cfsqltype="CF_SQL_VARCHAR" />,
<cfqueryparam value="#localphone#" cfsqltype="CF_SQL_VARCHAR" />
)
</cfquery>
<!--- If your server has a better way to get the ID --->
<!--- that is more reliable, use that instead. --->
<cfquery name="qGetID" datasource="contacts">
select contactId
from Contacts
where FirstName = <cfqueryparam value="#localFirstName#"
cfsqltype="CF_SQL_VARCHAR" />
and LastName = <cfqueryparam value="#localLastName#"
cfsqltype="CF_SQL_VARCHAR" />
and Address = <cfqueryparam value="#localAddress#"
cfsqltype="CF_SQL_VARCHAR" />
Example application
55

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents