<%@LANGUAGE="VBSCRIPT"%> <% curpath = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") curpath = Left(curpath, InstrRev(curpath, "/")) %> <% ' what year and month did the user choose? ' (again, if the numbers are not valid CInt will give an error) theYear = CInt( Request("chosenYear") ) theMonth = CInt( Request("chosenMonth") ) ' find first day of the given month... firstDate = DateSerial( theYear, theMonth, 1 ) ' day 1 of theMonth in theYear ' now comes the "quirk" from the MS documentation: lastDate = DateSerial( theYear, theMonth + 1, 0 ) 'SQL = "SELECT * FROM table WHERE theDateField BETWEEN #" & firstDate & "# AND #" & lastDate & "#" %> <% Dim rsBlogSite Dim rsBlogSite_numRows Set rsBlogSite = Server.CreateObject("ADODB.Recordset") rsBlogSite.ActiveConnection = MM_blog_STRING rsBlogSite.Source = "SELECT * FROM tblBlogRSS" rsBlogSite.CursorType = 0 rsBlogSite.CursorLocation = 2 rsBlogSite.LockType = 1 rsBlogSite.Open() rsBlogSite_numRows = 0 %> <% Dim rsCats Dim rsCats_numRows Set rsCats = Server.CreateObject("ADODB.Recordset") rsCats.ActiveConnection = MM_blog_STRING rsCats.Source = "SELECT *, (SELECT COUNT(*) FROM tblBlog WHERE tblBlog.BlogCat = tblCat.CatID) as CatCount FROM tblCat ORDER BY CatName ASC" rsCats.CursorType = 0 rsCats.CursorLocation = 2 rsCats.LockType = 1 rsCats.Open() rsCats_numRows = 0 %> <% Dim rsArchives Dim rsArchives_numRows Set rsArchives = Server.CreateObject("ADODB.Recordset") rsArchives.ActiveConnection = MM_blog_STRING rsArchives.Source = "SELECT DISTINCT Month(BlogDate) as ArchiveMonth, Year(BlogDate) as ArchiveYear FROM tblBlog ORDER BY Year(BlogDate) DESC, Month(BlogDate) DESC" rsArchives.CursorType = 0 rsArchives.CursorLocation = 2 rsArchives.LockType = 1 rsArchives.Open() rsArchives_numRows = 0 %> <% Dim rsArticles Dim rsArticles_numRows Set rsArticles = Server.CreateObject("ADODB.Recordset") rsArticles.ActiveConnection = MM_blog_STRING if instr(MM_blog_STRING, "Catalog") then rsArticles.Source = "SELECT * , (SELECT COUNT(*) FROM tblComment WHERE tblComment.BlogID = tblBlog.BlogID AND tblComment.CommentInclude = 1) as CommentCount, (SELECT COUNT(*) FROM tblBlog WHERE BlogCat = CatID) as CategoryCount FROM tblBlog, tblCat, tblAuthor WHERE BlogCat = CatID AND Month(BlogDate) = " & theMonth & " AND Year(BlogDate) = " & theYear & " AND tblBlog.BlogAuthor = tblAuthor.fldAuthorID ORDER BY BlogDate DESC" else rsArticles.Source = "SELECT * , (SELECT COUNT(*) FROM tblComment WHERE tblComment.BlogID = tblBlog.BlogID AND tblComment.CommentInclude = 1) as CommentCount, (SELECT COUNT(*) FROM tblBlog WHERE BlogCat = CatID) as CategoryCount FROM tblBlog, tblCat, tblAuthor WHERE BlogCat = CatID AND Month(BlogDate) = " & theMonth & " AND Year(BlogDate) = " & theYear & " AND tblBlog.BlogAuthor = tblAuthor.fldAuthorID ORDER BY BlogDate DESC" end if rsArticles.CursorType = 0 rsArticles.CursorLocation = 2 rsArticles.LockType = 1 rsArticles.Open() rsArticles_numRows = 0 %> <% Dim rsRecent Dim rsRecent_numRows Set rsRecent = Server.CreateObject("ADODB.Recordset") rsRecent.ActiveConnection = MM_blog_STRING rsRecent.Source = "SELECT * FROM tblBlog ORDER by BlogDate DESC" rsRecent.CursorType = 0 rsRecent.CursorLocation = 2 rsRecent.LockType = 1 rsRecent.Open() rsRecent_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 rsBlogSite_numRows = rsBlogSite_numRows + Repeat1__numRows %> <% Dim Repeat2__numRows Dim Repeat2__index Repeat2__numRows = -1 Repeat2__index = 0 rsArchives_numRows = rsArchives_numRows + Repeat2__numRows %> <% Dim Repeat4__numRows Dim Repeat4__index Repeat4__numRows = 10 Repeat4__index = 0 rsRecent_numRows = rsRecent_numRows + Repeat4__numRows %> <% Dim Repeat3__numRows Dim Repeat3__index Repeat3__numRows = -1 Repeat3__index = 0 rsArticles_numRows = rsArticles_numRows + Repeat3__numRows %> <%=(rsBlogSite.Fields.Item("blogTitle").Value)%> > <%=MonthName(theMonth)%><%Response.Write(" " & theYear)%> " />
<% While ((Repeat3__numRows <> 0) AND (NOT rsArticles.EOF)) %> <% if lastdate <> DoDateTime((rsArticles.Fields.Item("BlogDate").Value), 1, 1033) then%>

<%= DoDateTime((rsArticles.Fields.Item("BlogDate").Value), 1, 1033) %>

<%end if%>

"><%=(rsArticles.Fields.Item("BlogHeadline").Value)%>" id="<%=(rsArticles.Fields.Item("BlogID").Value)%>">

<%=(rsArticles.Fields.Item("BlogHTML").Value)%>
<% Repeat3__index=Repeat3__index+1 Repeat3__numRows=Repeat3__numRows-1 lastdate = DoDateTime((rsArticles.Fields.Item("BlogDate").Value), 1, 1033) rsArticles.MoveNext() Wend %>
<% rsBlogSite.Close() Set rsBlogSite = Nothing %> <% rsCats.Close() Set rsCats = Nothing %> <% rsArchives.Close() Set rsArchives = Nothing %> <% rsArticles.Close() Set rsArticles = Nothing %> <% rsRecent.Close() Set rsRecent = Nothing %>