departments.asp
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:2k
源码类别:

OA系统

开发平台:

Java

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <% '## this function prints out the count for each department separated by comma (for the applet samples)
  3. function PrintDepartmentCount(ByRef employeeRS)
  4. If employeeRS.EOF Then
  5. exit Function
  6. End If
  7. While Not employeeRS.EOF
  8. Response.Write employeeRS("DepartmentCount")
  9. employeeRS.MoveNext
  10. if not employeeRS.eof then
  11. Response.Write ","
  12. end if
  13. Wend
  14. employeeRS.MoveFirst
  15. end function
  16. '## this function prints out each department name separated by comma (for the applet labels)
  17. function PrintDepartmentLabels(ByRef employeeRS)
  18. If employeeRS.EOF Then
  19. exit Function
  20. End If
  21. While Not employeeRS.EOF
  22. Response.Write employeeRS("Department")
  23. employeeRS.MoveNext
  24. if not employeeRS.eof then
  25. Response.Write ","
  26. end if
  27. Wend
  28. employeeRS.MoveFirst
  29. end function
  30. set DbConn=server.createobject("adodb.connection")
  31. cnpath="DBQ=" & server.mappath("employees.mdb")
  32. 'Response.Write cnpath
  33. DbConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & cnpath 
  34. '## Let's say we have one table with employees. One of the columns
  35. '## is the department name, and the table name is employee
  36. '## The following lines gets the number of employees for each department
  37. Sql = "SELECT COUNT(*) AS DepartmentCount, Department FROM Employee GROUP BY Department ORDER BY Department"
  38. Set employeeRS = DbConn.Execute(Sql)
  39. %>
  40. <html>
  41. <body text="#000000" bgcolor="#FFFFFF">
  42. <applet 
  43. code="com.objectplanet.chart.BarChartApplet"
  44. archive="chart.jar"
  45. height=200 width=640 viewastext id=Applet5>
  46. <param name="sampleValues" value="<%call PrintDepartmentCount(employeeRS)%>">
  47. <param name="sampleLabels" value="<%call PrintDepartmentLabels(employeeRS)%>">
  48. <param name="sampleLabelsOn" value=true>
  49. <param name="valueLabelsOn" value=true>
  50. <param name="title" value="Departments">
  51. <param name="legendOn" value=true>
  52. <param name="multiColorOn" value=true>
  53. <param name="titleOn" value=true>
  54. <param name="valueLinesOn" value=true>
  55. </applet> 
  56. </body>
  57. </html>
  58. <% employeeRS.Close
  59. Set employeeRS = Nothing
  60. DbConn.Close
  61. Set DbConn = Nothing %>