Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > asp calendar help

Reply
Thread Tools

asp calendar help

 
 
Risikio
Guest
Posts: n/a
 
      01-11-2006
Not sure if I am in the right forum/area. I am looking for some help with
writing an .asp code. I was given an .asp code for an editable calendar, that
I think was downloaded from one of those free code websites. I am new to .asp
code, so I am asking for help. The code allows only one event per date to be
added to the calendar, and I need to make the code work for up to three
events per date. I have tried looping the code, but can not get it to read
the second event for a particular date from the MS Access database table. Any
help would be greatly appreciated. I have already spent more time on this
than I can afford to. Here is the code. Thanks.


<!--#include file = "database.inc" -->
<%
i = 0
iLastDay = LastDay(iYear, iMonth)
iFirstDay= Weekday(CDate(imonth & "/01/" & iYear))
iLastDay = iFirstDay + iLastDay - 1

do while i<= iLastDay
if i <> iLastDay then
Response.Write ("<tr>")
else
exit do
end if
for j=1 to 7

if (j < iFirstDay and i = 0) or (i + j > iLastDay) then

Response.Write ("<td width='90' height='75' valign='top' bgcolor='#000080'
NOWRAP></td>")
else
k = k + 1
sDate = "#" & iMonth & "/" & k & "/" & iYear & "#"
set rs = conn.execute("SELECT * FROM EVENTS WHERE DATE = " & sDate)
if rs.eof then
sHREF = "AddEvent.asp"
sEvent = ""
else
sHREF = "EditEvent.asp"
sEvent = "&nbsp;<P><FONT SIZE=-2 FACE='Arial,Helvetica'><A HREF =
'javascript:showevent(" & rs("ID") & ")'>" & rs("Description") & "</A><BR>"
if FixNull(rs("Time")) <> "" then sEvent = sEvent & rs("Time") & "<BR>"
if FixNull(rs("Location")) <> "" then sEvent = sEvent & rs("Location")
sEvent = sEvent & "</FONT>"
End If
sHREF = sHREF & "?Month=" & iMonth & "&Day=" & k & "&Year=" & iYear
Response.Write ("<td width='90' height='75' valign='top'>")
Response.Write "<B>"
Response.write k & "</A></B>" & sEvent
Response.Write ("</td>")
end if

next
i=i+7

loop
Response.Write ("</tr>")
%>
<!--#include file = "database_cleanup.inc"-->
 
Reply With Quote
 
 
 
 
Paxton
Guest
Posts: n/a
 
      01-11-2006

Risikio wrote:
> Not sure if I am in the right forum/area. I am looking for some help with
> writing an .asp code. I was given an .asp code for an editable calendar, that
> I think was downloaded from one of those free code websites. I am new to .asp
> code, so I am asking for help. The code allows only one event per date to be
> added to the calendar, and I need to make the code work for up to three
> events per date. I have tried looping the code, but can not get it to read
> the second event for a particular date from the MS Access database table. Any
> help would be greatly appreciated. I have already spent more time on this
> than I can afford to. Here is the code. Thanks.
>
>
> <!--#include file = "database.inc" -->
> <%
> i = 0
> iLastDay = LastDay(iYear, iMonth)
> iFirstDay= Weekday(CDate(imonth & "/01/" & iYear))
> iLastDay = iFirstDay + iLastDay - 1
>
> do while i<= iLastDay
> if i <> iLastDay then
> Response.Write ("<tr>")
> else
> exit do
> end if
> for j=1 to 7
>
> if (j < iFirstDay and i = 0) or (i + j > iLastDay) then
>
> Response.Write ("<td width='90' height='75' valign='top' bgcolor='#000080'
> NOWRAP></td>")
> else
> k = k + 1
> sDate = "#" & iMonth & "/" & k & "/" & iYear & "#"
> set rs = conn.execute("SELECT * FROM EVENTS WHERE DATE = " & sDate)
> if rs.eof then
> sHREF = "AddEvent.asp"
> sEvent = ""
> else
> sHREF = "EditEvent.asp"
> sEvent = "&nbsp;<P><FONT SIZE=-2 FACE='Arial,Helvetica'><A HREF =
> 'javascript:showevent(" & rs("ID") & ")'>" & rs("Description") & "</A><BR>"
> if FixNull(rs("Time")) <> "" then sEvent = sEvent & rs("Time") & "<BR>"
> if FixNull(rs("Location")) <> "" then sEvent = sEvent & rs("Location")
> sEvent = sEvent & "</FONT>"
> End If
> sHREF = sHREF & "?Month=" & iMonth & "&Day=" & k & "&Year=" & iYear
> Response.Write ("<td width='90' height='75' valign='top'>")
> Response.Write "<B>"
> Response.write k & "</A></B>" & sEvent
> Response.Write ("</td>")
> end if
>
> next
> i=i+7
>
> loop
> Response.Write ("</tr>")
> %>
> <!--#include file = "database_cleanup.inc"-->


You have to use the movenext method to write out more than one record
(if there is more than one record in the recordset in the first place)

.....amended code....

else

sEvent = ""
do until rs.eof

sHREF = "EditEvent.asp"

sEvent = sEvent & "&nbsp;<P><FONT SIZE=-2 FACE='Arial,Helvetica'><A
HREF =
'javascript:showevent(" & rs("ID") & ")'>" & rs("Description") &
"</A><BR>"

if FixNull(rs("Time")) <> "" then sEvent = sEvent & rs("Time") & "<BR>"
if FixNull(rs("Location")) <> "" then sEvent = sEvent & rs("Location")

sEvent = sEvent & "</FONT>"

rs.movenext
loop
End If

/P.

 
Reply With Quote
 
 
 
 
Risikio
Guest
Posts: n/a
 
      01-11-2006
Thank you very much! It works perfectly now.

"Paxton" wrote:

>
> Risikio wrote:
> > Not sure if I am in the right forum/area. I am looking for some help with
> > writing an .asp code. I was given an .asp code for an editable calendar, that
> > I think was downloaded from one of those free code websites. I am new to .asp
> > code, so I am asking for help. The code allows only one event per date to be
> > added to the calendar, and I need to make the code work for up to three
> > events per date. I have tried looping the code, but can not get it to read
> > the second event for a particular date from the MS Access database table. Any
> > help would be greatly appreciated. I have already spent more time on this
> > than I can afford to. Here is the code. Thanks.
> >
> >
> > <!--#include file = "database.inc" -->
> > <%
> > i = 0
> > iLastDay = LastDay(iYear, iMonth)
> > iFirstDay= Weekday(CDate(imonth & "/01/" & iYear))
> > iLastDay = iFirstDay + iLastDay - 1
> >
> > do while i<= iLastDay
> > if i <> iLastDay then
> > Response.Write ("<tr>")
> > else
> > exit do
> > end if
> > for j=1 to 7
> >
> > if (j < iFirstDay and i = 0) or (i + j > iLastDay) then
> >
> > Response.Write ("<td width='90' height='75' valign='top' bgcolor='#000080'
> > NOWRAP></td>")
> > else
> > k = k + 1
> > sDate = "#" & iMonth & "/" & k & "/" & iYear & "#"
> > set rs = conn.execute("SELECT * FROM EVENTS WHERE DATE = " & sDate)
> > if rs.eof then
> > sHREF = "AddEvent.asp"
> > sEvent = ""
> > else
> > sHREF = "EditEvent.asp"
> > sEvent = "&nbsp;<P><FONT SIZE=-2 FACE='Arial,Helvetica'><A HREF =
> > 'javascript:showevent(" & rs("ID") & ")'>" & rs("Description") & "</A><BR>"
> > if FixNull(rs("Time")) <> "" then sEvent = sEvent & rs("Time") & "<BR>"
> > if FixNull(rs("Location")) <> "" then sEvent = sEvent & rs("Location")
> > sEvent = sEvent & "</FONT>"
> > End If
> > sHREF = sHREF & "?Month=" & iMonth & "&Day=" & k & "&Year=" & iYear
> > Response.Write ("<td width='90' height='75' valign='top'>")
> > Response.Write "<B>"
> > Response.write k & "</A></B>" & sEvent
> > Response.Write ("</td>")
> > end if
> >
> > next
> > i=i+7
> >
> > loop
> > Response.Write ("</tr>")
> > %>
> > <!--#include file = "database_cleanup.inc"-->

>
> You have to use the movenext method to write out more than one record
> (if there is more than one record in the recordset in the first place)
>
> .....amended code....
>
> else
>
> sEvent = ""
> do until rs.eof
>
> sHREF = "EditEvent.asp"
>
> sEvent = sEvent & " <P><FONT SIZE=-2 FACE='Arial,Helvetica'><A
> HREF =
> 'javascript:showevent(" & rs("ID") & ")'>" & rs("Description") &
> "</A><BR>"
>
> if FixNull(rs("Time")) <> "" then sEvent = sEvent & rs("Time") & "<BR>"
> if FixNull(rs("Location")) <> "" then sEvent = sEvent & rs("Location")
>
> sEvent = sEvent & "</FONT>"
>
> rs.movenext
> loop
> End If
>
> /P.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar GadGets does not show calendar iccsi Windows 64bit 4 08-14-2011 01:52 PM
How to Synchronise Hotmail Calendar with Standard Outlook Calendar using Outlook Connector ?? Synapse Syndrome Computer Support 0 12-02-2007 04:19 AM
Thunderbird Calendar with Exchange 2003 Calendar and Public FoldersCalendar jincmcse Firefox 1 09-03-2005 02:46 AM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net 3 06-23-2004 01:41 PM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net Web Controls 0 06-23-2004 12:06 PM



Advertisments