Forums

ASP

This topic is locked

Selecting records older than current date

Posted 31 May 2005 01:00:34
1
has voted
31 May 2005 01:00:34 Javier Castro posted:
Hi,

I have 2 events pages: Upcoming events and past events. The events page is working nicely, but displaying Past Events (1 year old) that are older than the current date is giving me trouble. Help please. This is the code I'm using:

<%
Dim rsPosts__MMColParam1
rsPosts__MMColParam1 = "1/1/2004"
If (Now() -1 <> "" Then
rsPosts__MMColParam1 = Now() -1
End If
%>

<%
Dim rsPosts
Dim rsPosts_numRows

Set rsPosts = Server.CreateObject("ADODB.Recordset"
rsPosts.ActiveConnection = MM_connCMS_STRING
rsPosts.Source = "SELECT bitPostShow, dteEventDate, intCatID, tblPosts.intChapID, intPostBy, intPostID, memPostContent, txtEventTitle, txtFileName, txtImageName, txtUsername FROM tblPosts, tblUsers WHERE bitPostShow = " + Replace(rsPosts__MMColParam, "'", "''" + " AND tblPosts.intPostBy = tblUsers.intUserID AND dteEventDate > # " + Replace(rsPosts__MMColParam1, "'", "''" + "# AND intCatID LIKE '" + Replace(rsPosts__MMColParam2, "'", "''" + "' ORDER BY dteEventDate DESC"
rsPosts.CursorType = 0
rsPosts.CursorLocation = 2
rsPosts.LockType = 1
rsPosts.Open()

rsPosts_numRows = 0
%>


Thanks,
Javier

Reply to this topic