home *** CD-ROM | disk | FTP | other *** search
- <!--- This view-only example illustrates usage
- of StructCopy. --->
- <P>This file is similar to addemployee.cfm, which is called
- by StructNew, StructClear, and StructDelete. To test this file,
- copy the StructCopy function to the appropriate place
- in addemployee.cfm.
- <P>
- To run this snippet
- under UNIX, you must add employee ID generation logic.
- <!---
- <cfswitch expression="#ThisTag.ExecutionMode#">
- <cfcase value="start">
- <CFIF StructIsEmpty(attributes.EMPINFO)>
- <CFOUTPUT>Error. No employee data was passed.</cfoutput>
- <CFEXIT METHOD="ExitTag">
- <cfelse>
- <CFSET tempStruct = StructCopy(EMPINFO)>
- <CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
- INSERT INTO Employees
- (FirstName, LastName, Email, Phone, Department)
- VALUES
- <CFOUTPUT>
- (
- æ#StructFind(attributes.tempStruct, "firstname")#Æ ,
- æ#StructFind(attributes.tempStruct, "lastname")#Æ ,
- æ#StructFind(attributes.tempStruct, "email")#Æ ,
- æ#StructFind(attributes.tempStruct, "phone")#Æ ,
- æ#StructFind(attributes.tempStruct, "department")#Æ
- )
- </cfoutput>
- </cfquery>
- </cfif>
- <CFOUTPUT><HR>Employee Add Complete
- <P>#StructCount(attributes.tempStruct)# columns added.
- </cfoutput>
- </cfcase>
- </cfswitch> --->
-