home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / Code / ch39 / schedule.asp < prev    next >
Encoding:
Text File  |  1997-07-10  |  3.9 KB  |  151 lines

  1. <%@ LANGUAGE="VBSCRIPT" %><html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type"
  5. content="text/html; charset=iso-8859-1">
  6. <meta name="FORMATTER" content="Microsoft FrontPage 2.0">
  7. <meta name="GENERATOR" content="Microsoft FrontPage 2.0">
  8. <title>Course Schedule</title>
  9. <%
  10.  
  11.  
  12.  
  13. If IsObject(Session("LocalTraining_conn")) Then
  14.  
  15.     Set conn = Session("LocalTraining_conn")
  16.  
  17. Else
  18.  
  19.     Set conn = Server.CreateObject("ADODB.Connection")
  20.  
  21.     Conn.Open "DSN=LocalTraining"
  22.  
  23.     Set Session("LocalTraining_conn") = conn
  24.  
  25. End If
  26.  
  27.  
  28.  
  29. SQL = "SELECT Category.Name, Course.Number, Course.Title, "
  30. SQL = SQL & "IIf([Cost]>0,Format([Cost],'Currency'),'-') AS CourseCost, "
  31. SQL = SQL & "Format([Start_Date],'mmm d, yy') & IIf([End_Date]<>[Start_Date], "
  32. SQL = SQL & "' to ' & Format([End_Date],'mmm d, yy'),'') AS DateRange "
  33. SQL = SQL & "FROM Schedule, Course, Instructor, Location, Category "
  34. SQL = SQL & "WHERE (Schedule.Course_ID = Course.ID) "
  35. SQL = SQL & "AND (Schedule.Instructor = Instructor.Id) "
  36. SQL = SQL & "AND (Schedule.Location = Location.Id) "
  37. SQL = SQL & "AND (Course.Category = Category.Id) "
  38. SQL = SQL & "AND (Schedule.Start_Date > Now()) "
  39. SQL = SQL & "ORDER BY Category.Name, Course.Number"
  40.  
  41.  
  42. Set RSSchedule = Conn.Execute(SQL)
  43.  
  44.  
  45.  
  46.     GroupName = RSSchedule("Name")
  47.  
  48.     CourseNumber = RSSchedule("Number")
  49.  
  50. %>
  51. </head>
  52. <body bgcolor="#FFFFFF">
  53. <div align="left">
  54.  
  55. <table border="0" width="100%" bgcolor="#000000">
  56.     <tr>
  57.         <td>
  58.             <font color="#FFFFFF" size="3" face="Verdana">
  59.                 <strong><%=RSSchedule("Name")%></strong>
  60.             </font>
  61.             <table border="0" width="100%" bgcolor="#FFFFFF">
  62.                     <tr>
  63.                         <td valign="top" width="55%">
  64.                         <font color="#FF0000" size="2" face="Verdana">
  65.                             <strong><%=RSSchedule("Number")%></strong>
  66.                         </font>
  67.                         <font size="2" face="Verdana">
  68.                             <strong><%=RSSchedule("Title")%></strong>
  69.                         </font>
  70.                     </td>
  71.                             <td valign="top">
  72. <%
  73.  
  74.  
  75.  
  76. Do While Not RSSchedule.EOF
  77.  
  78.  
  79.  
  80. If GroupName <> RSSchedule("Name") then
  81.  
  82.     GroupName = RSSchedule("Name")
  83.  
  84.     CourseNumber = RSSchedule("Number")
  85.  
  86.  
  87.  
  88.  
  89.  
  90. %>
  91.                     </td>
  92.                     <td valign="top" width="10%">
  93.                         <font size="2" face="Verdana">
  94.                             <%=CourseCost%>
  95.                         </font>
  96.                     </td>
  97.                     </tr>
  98.             </table>
  99.         </td>
  100.     </tr>
  101.     <tr>
  102.         <td>
  103.             <font color="#FFFFFF" size="3" face="Verdana">
  104.                 <strong><%=RSSchedule("Name")%></strong>
  105.             </font>
  106.             <table border="0" width="100%" bgcolor="#FFFFFF">
  107.                 <tr>
  108.                     <td valign="top" width="55%">
  109.                         <font color="#FF0000" size="2" face="Verdana">
  110.                             <strong><%=RSSchedule("Number")%></strong>
  111.                         </font>
  112.                         <font size="2" face="Verdana">
  113.                             <strong><%=RSSchedule("Title")%></strong>
  114.                         </font>
  115.                     </td>
  116.                     <td valign="top" width="35%">
  117.                         <font size="2" face="Verdana">
  118.                             <%=RSSchedule("DateRange")%><br>
  119. <%
  120. else
  121.  
  122.     If CourseNumber <> RSSchedule("Number") then
  123.  
  124.         CourseNumber = RSSchedule("Number")
  125. %>
  126.                          </font>
  127.                     </td>
  128.                     <td valign="top" width="10%">
  129.                         <font size="2" face="Verdana">
  130.                             <%=CourseCost%>
  131.                         </font>
  132.                     </td>
  133.                 </tr>
  134.                 <tr>
  135.                     <td valign="top" width="55%">
  136.                         <font color="#FF0000" size="2" face="Verdana">
  137.                             <strong><%=RSSchedule("Number")%></strong>
  138.                         </font>
  139.                         <font size="2" face="Verdana">
  140.                             <strong><%=RSSchedule("Title")%></strong>
  141.                         </font>
  142.                     </td>
  143.                     <td valign="top" width="35%">
  144.                         <font size="2" face="Verdana">
  145.                             <%=RSSchedule("DateRange")%><br>
  146.     <%else%>                 <font size="2" face="Verdana">
  147.                             <%=RSSchedule("DateRange")%>
  148.                         </font><br>
  149.     <%end if%>
  150. <%end if%>
  151.  
  152. <%
  153.  
  154. CourseCost = RSSchedule("CourseCost")
  155.  
  156.  
  157.  
  158. Cost = RSSchedule("CourseCost")
  159.  
  160.  
  161.  
  162. RSSchedule.MoveNext
  163.  
  164. Loop
  165.  
  166.  
  167.  
  168. %>                         </font>
  169.                     </td>
  170.                     <td valign="top" width="10%">
  171.                         <font size="2" face="Verdana">
  172.                             <%=Cost%>
  173.                         </font>
  174.                     </td>
  175.                 </tr>
  176.             </table>
  177.         </td>
  178.     </tr>
  179. </table>
  180.  
  181. <%RSSchedule.Close%>
  182.  
  183. </body>
  184. </html>
  185.