home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / structisempty.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.5 KB  |  39 lines

  1. <!--- This view-only example illustrates usage
  2.       of StructIsEmpty. --->
  3. <P>This file is identical to addemployee.cfm, which is called
  4. by StructNew, StructClear, and StructDelete. It is an 
  5. example of a custom tag used to add employees. Employee 
  6. information is passed through the employee structure (the 
  7. EMPINFO attribute).
  8. <P>
  9. To run this snippet
  10. under UNIX, you must add employee ID generation logic.
  11. <!--- 
  12. <cfswitch expression="#ThisTag.ExecutionMode#">
  13.    <cfcase value="start">
  14.       <CFIF StructIsEmpty(attributes.EMPINFO)>
  15.         <CFOUTPUT>Error. No employee data was passed.</cfoutput>
  16.           <CFEXIT METHOD="ExitTag">
  17.         <cfelse>
  18.           <!--- Add the employee --->
  19.           <!--- In UNIX, you must also add the Emp_ID --->
  20.           <!---
  21.            <CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
  22.             INSERT INTO Employees(FirstName, LastName, Email, Phone, Department)
  23.               VALUES 
  24.                 <CFOUTPUT>
  25.                   (
  26.                     '#StructFind(attributes.EMPINFO, "firstname")#' ,
  27.                     '#StructFind(attributes.EMPINFO, "lastname")#' ,
  28.                     '#StructFind(attributes.EMPINFO, "email")#' ,
  29.                     '#StructFind(attributes.EMPINFO, "phone")#' ,
  30.                     '#StructFind(attributes.EMPINFO, "department")#'
  31.                    )
  32.                 </cfoutput> 
  33.           </cfquery>
  34.         </cfif>
  35.       <CFOUTPUT><HR>Employee Add Complete</cfoutput>
  36.    </cfcase>
  37. </cfswitch> --->
  38.  
  39.