Solved

Help filtering records

Posted on 2003-11-25
4
279 Views
Last Modified: 2012-06-21
I'm trying to modify a calendar application I found.  I've got a master calendar that displays events taking place in all the rooms in the database.  Now I'm trying to write individual calendar views for each room.    

I've got it working so the current month's events show up in the proper room, but if I try to advance a month, I get a blank calendar.  I'm not sure if the problem lies in my select statement  or the way I've got the link set up to advance to the next month.

Select statement:

rsEventsDay.Source = "SELECT *  FROM EVENTS, TYPES WHERE EVE_APPROVED=1 AND EVE_TYPE = " + Replace(rsEventsDay__MMColParam, "'", "''") + " AND EVE_TYPE = TYPE_ID  ORDER BY EVE_DATED"

Here's the code  I was trying to advance to the next month:

<a fref="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>

Can someone point me in the right direction?  Thanks!
0
Comment
Question by:mtarby
  • 2
4 Comments
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9819681
<a fref="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>

should be..

<a href="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>

Anyway.. i dont think that should be the error.. post the rest of the code as the code above seems to be correct..

Cheers!!
0
 

Author Comment

by:mtarby
ID: 9819871
Sorry - you were right, that wasn't causing the error.  Here's more of the code:

<%
Dim rsEventsDay__MMColParam
rsEventsDay__MMColParam = "0"
if (Request.QueryString("iType") <> "") then rsEventsDay__MMColParam = Request.QueryString("iType")
%>
<%
set rsEventsDay = Server.CreateObject("ADODB.Recordset")
rsEventsDay.ActiveConnection = MM_connDUcalendar_STRING
rsEventsDay.Source = "SELECT *  FROM EVENTS, TYPES WHERE EVE_APPROVED=1 AND EVE_TYPE = " + Replace(rsEventsDay__MMColParam, "'", "''") + " AND EVE_TYPE = TYPE_ID  ORDER BY EVE_DATED"
rsEventsDay.CursorType = 0
rsEventsDay.CursorLocation = 2
rsEventsDay.LockType = 3
rsEventsDay.Open()
rsEventsDay_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsEventsDay_numRows = rsEventsDay_numRows + Repeat1__numRows
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>      
function DoTrimProperly(str, nNamedFormat, properly, pointed, points)
  dim strRet
  strRet = Server.HTMLEncode(str)
  strRet = replace(strRet, vbcrlf,"")
  strRet = replace(strRet, vbtab,"")
  If (LEN(strRet) > nNamedFormat) Then
    strRet = LEFT(strRet, nNamedFormat)                  
    If (properly = 1) Then                              
      Dim TempArray                                                
      TempArray = split(strRet, " ")      
      Dim n
      strRet = ""
      for n = 0 to Ubound(TempArray) - 1
        strRet = strRet & " " & TempArray(n)
      next
    End If
    If (pointed = 1) Then
      strRet = strRet & points
    End If
  End If
  DoTrimProperly = strRet
End Function
</SCRIPT>
<%
If Request("iDate") <> "" Then
   iDate = DateValue(Request("iDate"))
Else
   iDate = date
End if

CurrentMonth = Month(iDate)
CurrentMonthName = MonthName(CurrentMonth)
CurrentYear = Year(iDate)

FirstDayDate = DateSerial(CurrentYear, CurrentMonth, 1)
FirstDay = WeekDay(FirstDayDate, 0)
CurrentDay = FirstDayDate

%>

And where I'm trying to put the link:

 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr align="center" valign="middle">
<td align = "left" class="bgMonthListing">&laquo; <a href="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",-1, iDate))%>"><%= UCASE(Left(MonthName(Month(DateAdd("m", -1, CurrentDay))),3)) %></a></td>
<td class="bgMonthListing"><%= UCASE(rsEventsDay.Fields.Item("TYPE_NAME").Value)%> - <%= UCASE(CurrentMonthName & " " & CurrentYear) %></td>
<td align = "right" class="bgMonthListing"><a href="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>
&raquo;</td>
</tr>
</table>

Thanks!



0
 

Accepted Solution

by:
jenn5175 earned 250 total points
ID: 9852951
Looks like you're not sending iType in your querystring so iType=0 and you probably don't have anything in the db for a iType=0
0
 

Author Comment

by:mtarby
ID: 9853249
Thanks!  I knew I was missing something obvious - its working great now.  
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now