% dim objRs, objCon, dtToday cat = Request.QueryString("cat") if cat = "" then cat = "all" End If 'Write a select box Sub DropDown(tbl, valField, selVal, Field) set rsDrop = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT DISTINCT " & valField & ", " & Field & " FROM " & tbl & _ " ORDER BY " & field rsDrop.Open strSQL, objCon Response.Write "" do until rsDrop.EOF Response.Write "" & vbcrlf rsDrop.MoveNext loop rsDrop.Close set rsDrop=nothing end sub ' Format the ouput Function FormatStr(String) on Error resume next String = Replace(String, CHR(13), "") String = Replace(String, CHR(10) & CHR(10), "
")
String = Replace(String, CHR(10), "
")
FormatStr = String
End Function
function dNum(n)
if n >= 10 then
dNum = cstr(n)
Else
dNum = "0" & cstr(n)
End If
End Function
'SQL Formatted Date
Function SQLDate(dt)
SQLDate = cdbl(dt) ' Year(dt) & "-" & DNum(Month(dt)) & "-" & Dnum(Day(dt)) & " " & dnum(hour(dt)) & ":" & dnum(Minute(dt))
End Function
' Get the previous sundays date
Function DtPrevSunday(ByVal dt)
Do While WeekDay(dt) > vbSunday
dt = DateAdd("d", -1, dt)
Loop
DtPrevSunday = dt
End Function
'Todays Date
dtToday = Date()
Dim dtCurViewMonth ' First day of the currently viewed month
Dim dtCurViewDay ' Current day of the currently viewed month
Dim frmDate ' Date submitted by form
' if the GO button was used, build the date from the month and year
If InStr(1, Request.Form, "subGO", 1) > 0 then
if Request.Form("CURDATE_month") = "" then
tmpMonth = month(now())
else
tmpMonth = Request.Form("CURDATE_month")
End If
if Request.Form("CURDATE_year") = "" then
tmpyear = year(now())
else
tmpyear = Request.Form("CURDATE_year")
End If
tmpDate = "1 " & tmpMonth & " 1999"
mnth = Month(tmpDate)
frmDate = DateSerial(tmpyear, mnth, 1)
Else
frmDate = Request.Form("CURDATE")
end if
if Request("view_date") <> "" then
frmDate= DateSerial(year(Request("view_date")), month(Request("view_date")), 1)
end if
' if posted from the form
' if prev button was hit on the form
If InStr(1, Request.Form, "subPrev", 1) > 0 Then
dtCurViewMonth = DateAdd("m", -1, frmDate)
' if next button was hit on the form
ElseIf InStr(1, Request.Form, "subNext", 1) > 0 Then
dtCurViewMonth = DateAdd("m", 1, frmDate)
' anyother time
Else
' date add in text box
If InStr(1, Request.Form, "subGO", 1) > 0 then
dtCurViewMonth = frmDate
Else
if Request("view_date") <> "" then
dtCurviewMonth = frmDate
else
dtCurViewMonth = DateSerial(Year(dtToday), Month(dtToday), 1)
End If
End If
End If
Dim iDay, iWeek, sFontColor
strSQL ="SELECT diary.id, diary.dte,diary.enddate, diary.etitle, Diary_Categorys.Category, Diary_Categorys.Colour, Diary_Categorys.BgColour" & _
" FROM Diary_Categorys RIGHT JOIN diary ON Diary_Categorys.Cat_ID = diary.Category "
if cat <> "all" then
strSQL = strSQL & " AND Diary_Categorys.Cat_ID = " & cat
End If
strSQL = strSQL & " order by diary.dte,diary.enddate"
set objRs = cn.Execute (StrSql)
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%>