473,383 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

asp calendar help

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"-->
Jan 11 '06 #1
2 1561

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.

Jan 11 '06 #2
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.

Jan 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: cg_news | last post by:
In short, what I am trying to do is, based on a date, calculate the week of year (as described in ISO 8601), then calculate the first and last date in this week period and return them in the format...
0
by: GFro | last post by:
I have a calendar page that returns a date to a textbox on the parent page. It is returning the wrong format on the deployment server. On the development server the calendar returns to textbox in...
3
by: Peter | last post by:
Is there anyway to make the System.Web.UI.WebControls.Calendar to display only Month Name and Year, like: January, 2006 February, 2006 ..... .... .... ....
6
by: Mike9900 | last post by:
Hello, I want to view the calendar in another culture, for example let it show in Arabic. I use this code in the Main, but the calendar is still in the same culture: CultureInfo sa = new...
3
by: brianwolters | last post by:
Hello, I have a calendar and a textbox right below it on my webpage. I need help with creating some code to display information about the date the user clicked in the text box below it. For...
12
cassbiz
by: cassbiz | last post by:
I downloaded this calendar off the web and am trying have it show twice, once as calendar.php and the second time as calendar1.php I need the visitor to be able to select a beginning date and an...
3
by: thorpk | last post by:
I posted this problem earlier in the month and some one decided it was better to change the subject and ask a completely different question. I am therefore reposting. I am hoping some one can...
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
7
by: William (Tamarside) | last post by:
Please, if you have the time and knowledge to help me I'd truly appreciate it! I need to build a calendar page that displays available/unavailable info from a DB and colour a cell according to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.