Event Calendar

<% function GetDataConnection() dim oConn, strConn Set oConn = Server.CreateObject("ADODB.Connection") strConn = "Provider=SQLOLEDB; Data Source=adspm; Initial Catalog=TeamWeb; " strConn = strConn & "User Id=TeamWeb; Password=x" oConn.Open strConn set GetDataConnection = oConn end function %>
<% '******************************************************************** ' Name: Calendar.asp ' ' Purpose: Main calendar page that shows events in a calendar format ' '******************************************************************** dim dbConn, rs, nDex, nMonth, nYear, dtDate ' Get the current date dtDate = Now() ' Set the Month and Year nMonth = Request.QueryString("nMonth") nYear = Request.QueryString("nYear") if nMonth = "" then nMonth = Month(dtDate) if nYear = "" then nYear = Year(dtDate) ' Set the date to the first of the current month dtDate = DateSerial(nYear, nMonth, 1) Set dbConn = GetDataConnection Set rs = dbConn.Execute ("GetSchedule " & nMonth & ", " & nYear) DoHeader(MonthName(Month(dtDate)) & "  " & nYear) %>
 
<% ' Add blank cells until the proper day for nDex = 1 to Weekday(dtDate) - 1 Response.Write "" next do Response.Write "" if WeekDay(dtDate) = 7 then Response.Write "" & vbCrLf & "" end if dtDate = DateAdd("d", 1, dtDate) loop until (Month(dtDate) <> CInt(nMonth)) ' Add blank cells to fill out the rest of the month if needed if Weekday(dtDate) <> 1 then for nDex = Weekday(dtDate) to 7 Response.Write "" next end if %>
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 " & Day(dtDate) & "
 
" if not rs.EOF then do if CInt(rs("nDay")) <> CInt(Day(dtDate)) then exit do Response.Write "" & rs("vcEvent") Response.Write "
" rs.MoveNext if rs.EOF then exit do loop end if Response.Write "
 
Add/Remove Events
<- Previous Month Next Month - >