jimthepict
07-22-03, 04:24 PM
Hi,
I am busy making a gig list page for my site, i am only learning asp but have succesfully got the results to display within a repeating region. The problem I have is (obviously) that it displays gig dates that have expired. What code can I use to display results if equal to or greater than current date? This would presumably be handle in asp as opposed to the access db? There is a gig date in db which has to be filtered somewhere to only display relevant gigs.....just not sure how at this point.
Help much appreciated, thanks.
Here is my code so far:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="lugs_gigs/connection.asp" -->
<%
Dim rsGig__MMColParam
rsGig__MMColParam = "0"
If (Request("MM_EmptyValue") <> "") Then
rsGig__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsGig
Dim rsGig_numRows
Set rsGig = Server.CreateObject("ADODB.Recordset")
rsGig.ActiveConnection = MM_Gigs_STRING
rsGig.Source = "SELECT * FROM qryGigs WHERE Confirmed <> " + Replace(rsGig__MMColParam, "'", "''") + " ORDER BY Gig_Date ASC"
rsGig.CursorType = 0
rsGig.CursorLocation = 2
rsGig.LockType = 1
rsGig.Open()
rsGig_numRows = 0
%>
<%
Dim rptCfGigs__numRows
Dim rptCfGigs__index
rptCfGigs__numRows = -1
rptCfGigs__index = 0
rsGig_numRows = rsGig_numRows + rptCfGigs__numRows
%>
<SCRIPT runat=SERVER language=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID > -1) Then
Session.LCID = nLCID
End If
If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID > -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet End Function
</SCRIPT>
<html>
<head>
<title>blah</title>
</head>
<body>
<table width="85%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div align="left">
<h3>Skelpit Lug Gigs</h3>
<p>Confirmed Gigs: (<a href="gigs_tbc.asp">Click here for gigs booked but not yet confirmed</a>)</p>
<p>TBA = To Be Arranged</p>
<% While ((rptCfGigs__numRows <> 0) AND (NOT rsGig.EOF))
%>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#ffffff">
<!--DWLayoutTable-->
<tr bordercolor="cccccc" bgcolor="f5f5f5">
<td height="10" colspan="3" valign="middle"><div align="center">
<p class="heading"><%= DoDateTime((rsGig.Fields.Item("Gig_Date").Value), 1, 1033) %>
</p></div></td></tr>
<tr bordercolor="ffffff" bgcolor="#ffffff">
<td width="146" height="20"><div align="center">
<p>
If (rsGig("Function") <> "" ) Then 'if db Function column is not empty then show contents%>
<%=(rsGig.Fields.Item("Function").Value)%>
<% Else %>
TBA
<% End If %>
</p>
</div></td>
<td width="196"><div align="center">
<p>
If (rsGig("Venue") <> "" ) Then 'if db Venue column is not empty then show contents%>
<%=(rsGig.Fields.Item("Venue").Value)%>
<% Else %>
TBA
<% End If %>
</p></div></td>
<td width="140"><p align="center">
<% If (rsGig("Location") <> "" ) Then 'if db Location column is not empty then show contents%>
<%=(rsGig.Fields.Item("Location").Value)%>
<% Else %>
TBA
<% End If %>
</p></td></tr>
<tr bordercolor="ffffff" bgcolor="#ffffff">
<td height="20" colspan="3"><div align="center">
<p>
From:
<% If (rsGig("StartTime") <> "" ) Then 'if db StartTime column is not empty then show contents%>
<%= DoDateTime((rsGig.Fields.Item("StartTime").Value), 4, 1033) %>
<% Else %>
TBA
<% End If %>
To:
<% If (rsGig("EndTime") <> "" ) Then 'if db EndTime column is not empty then show contents%>
<%= DoDateTime((rsGig.Fields.Item("EndTime").Value), 4, 1033) %>
<% Else %>
TBA
<% End If %>
</p></div></td></tr></table><br>
<%
rptCfGigs__index=rptCfGigs__index+1
rptCfGigs__numRows=rptCfGigs__numRows-1
rsGig.MoveNext()
Wend
%>
</div></td></tr></table>
</body>
</html>
<%
rsGig.Close()
Set rsGig = Nothing
%>
I am busy making a gig list page for my site, i am only learning asp but have succesfully got the results to display within a repeating region. The problem I have is (obviously) that it displays gig dates that have expired. What code can I use to display results if equal to or greater than current date? This would presumably be handle in asp as opposed to the access db? There is a gig date in db which has to be filtered somewhere to only display relevant gigs.....just not sure how at this point.
Help much appreciated, thanks.
Here is my code so far:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="lugs_gigs/connection.asp" -->
<%
Dim rsGig__MMColParam
rsGig__MMColParam = "0"
If (Request("MM_EmptyValue") <> "") Then
rsGig__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsGig
Dim rsGig_numRows
Set rsGig = Server.CreateObject("ADODB.Recordset")
rsGig.ActiveConnection = MM_Gigs_STRING
rsGig.Source = "SELECT * FROM qryGigs WHERE Confirmed <> " + Replace(rsGig__MMColParam, "'", "''") + " ORDER BY Gig_Date ASC"
rsGig.CursorType = 0
rsGig.CursorLocation = 2
rsGig.LockType = 1
rsGig.Open()
rsGig_numRows = 0
%>
<%
Dim rptCfGigs__numRows
Dim rptCfGigs__index
rptCfGigs__numRows = -1
rptCfGigs__index = 0
rsGig_numRows = rsGig_numRows + rptCfGigs__numRows
%>
<SCRIPT runat=SERVER language=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID > -1) Then
Session.LCID = nLCID
End If
If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID > -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet End Function
</SCRIPT>
<html>
<head>
<title>blah</title>
</head>
<body>
<table width="85%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div align="left">
<h3>Skelpit Lug Gigs</h3>
<p>Confirmed Gigs: (<a href="gigs_tbc.asp">Click here for gigs booked but not yet confirmed</a>)</p>
<p>TBA = To Be Arranged</p>
<% While ((rptCfGigs__numRows <> 0) AND (NOT rsGig.EOF))
%>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#ffffff">
<!--DWLayoutTable-->
<tr bordercolor="cccccc" bgcolor="f5f5f5">
<td height="10" colspan="3" valign="middle"><div align="center">
<p class="heading"><%= DoDateTime((rsGig.Fields.Item("Gig_Date").Value), 1, 1033) %>
</p></div></td></tr>
<tr bordercolor="ffffff" bgcolor="#ffffff">
<td width="146" height="20"><div align="center">
<p>
If (rsGig("Function") <> "" ) Then 'if db Function column is not empty then show contents%>
<%=(rsGig.Fields.Item("Function").Value)%>
<% Else %>
TBA
<% End If %>
</p>
</div></td>
<td width="196"><div align="center">
<p>
If (rsGig("Venue") <> "" ) Then 'if db Venue column is not empty then show contents%>
<%=(rsGig.Fields.Item("Venue").Value)%>
<% Else %>
TBA
<% End If %>
</p></div></td>
<td width="140"><p align="center">
<% If (rsGig("Location") <> "" ) Then 'if db Location column is not empty then show contents%>
<%=(rsGig.Fields.Item("Location").Value)%>
<% Else %>
TBA
<% End If %>
</p></td></tr>
<tr bordercolor="ffffff" bgcolor="#ffffff">
<td height="20" colspan="3"><div align="center">
<p>
From:
<% If (rsGig("StartTime") <> "" ) Then 'if db StartTime column is not empty then show contents%>
<%= DoDateTime((rsGig.Fields.Item("StartTime").Value), 4, 1033) %>
<% Else %>
TBA
<% End If %>
To:
<% If (rsGig("EndTime") <> "" ) Then 'if db EndTime column is not empty then show contents%>
<%= DoDateTime((rsGig.Fields.Item("EndTime").Value), 4, 1033) %>
<% Else %>
TBA
<% End If %>
</p></div></td></tr></table><br>
<%
rptCfGigs__index=rptCfGigs__index+1
rptCfGigs__numRows=rptCfGigs__numRows-1
rsGig.MoveNext()
Wend
%>
</div></td></tr></table>
</body>
</html>
<%
rsGig.Close()
Set rsGig = Nothing
%>