Advertisement
Nodrogc

CF1

Sep 18th, 2021
1,439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cfcomponent>
  2. <cffunction name="allemployees" access="public" output="false"
  3. returntype="query">
  4. <cfset var getNames="">
  5. <cfquery name="getNames" datasource="cfdocexamples">
  6. SELECT * FROM Employee
  7. </cfquery>
  8. </cffunction>
  9.  
  10. <cffunction name="namesalarycontract" access="public" output="false"
  11. returntype="query">
  12. <cfset var EmpList="">
  13. <cfquery name="EmpList" datasource="cfdocexamples">
  14. SELECT Firstname, Lastname, Salary, Contract
  15. FROM Employee
  16. </cfquery>
  17. </cffunction>
  18.  
  19. <cffunction name="fullname" access="public" output="false"
  20. returntype="query">
  21. <cfset var engquery="">
  22. <cfquery name="engquery" datasource="cfdocexamples">
  23. SELECT FirstName || ' ' || LastName AS FullName
  24. FROM Employee
  25. </cfquery>
  26. </cffunction>
  27.  
  28. <cffunction name="bydept" access="public" output="false" returntype="query">
  29. <cfset var deptquery="">
  30. <cfquery name="deptquery" datasource="cfdocexamples">
  31. SELECT Dept_ID, FirstName || ' ' || LastName
  32. AS FullName
  33. FROM Employee
  34. ORDER BY Dept_ID
  35. </cfquery>
  36. </cffunction>
  37.  
  38. <cffunction name="employeebyURLID" access="public" output="false"
  39. returntype="query">
  40. <cfset var GetRecordtoUpdate="">
  41. <cfquery name="GetRecordtoUpdate" datasource="cfdocexamples">
  42. SELECT * FROM Employee
  43. WHERE Emp_ID = #URL.Emp_ID#
  44. </cfquery>
  45. </cffunction>
  46.  
  47. <cffunction name="deleteemployee" access="public" output="false"
  48. returntype="void">
  49. <cfset var DeleteEmployee="">
  50. <cfquery name="DeleteEmployee" datasource="cfdocexamples">
  51. DELETE FROM Employee
  52. WHERE Emp_ID = #Form.Emp_ID#
  53. </cfquery>
  54. </cffunction>
  55.  
  56. <cffunction name="distinctlocs"access="public" output="false"
  57. returntype="query">
  58. <cfset var GetDepartments="">
  59. <cfquery name="GetDepartments" datasource="cfdocexamples">
  60. SELECT DISTINCT Location
  61. FROM Departmt
  62. </cfquery>
  63. </cffunction>
  64. </cfcomponent>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement