aperseghin
09-01-2005, 08:23 PM
Ok im trying to do something simple. i have a recordset containing rows from a database.. the rows are 3 fields long ("date","minium_stay","registerd")
Date is a date field abd the other 2 are bits (true false)
I am drawing a calendar and i want to loop through the record set as i draw every day to decide how to draw that day (aka red box if registerd is true and a "m" next to the day if that field is true)
here is what i have (dosent work)
calendar_html = calendar_html & "<tr>"
'Fill the first week of the month with the appropriate number of blanks.
for week_day = 0 to first_week_day - 1
calendar_html = calendar_html & "<td style=""background-color:333333; color:000000;""> </td>"
next
week_day = first_week_day
for day_counter = 1 to days_in_this_month
week_day = week_day mod 7
if week_day = 0 then
calendar_html = calendar_html & "</tr><tr>"
end if
Set rs = Server.CreateObject ("ADODB.Recordset")
SQL = "select * from reservations where year(reserved) = "&year(today)&" and month(reserved) = "&month(today)
rs.open SQL,"DSN=*******;uid=*******;pwd=*******"
'check to see if there are any dates
if not rs.EOF then
rs.movefirst
day_color="ffffff"
day_m=""
do until day(rs("reserved")) = day_counter <----- this is line 84
rs.movenext
loop
if rs("rStay") = "True" then day_color = "red"
if rs("mStay") = "True" then day_m = "m"
calendar_html = calendar_html & "<td align=""center"" style=""background-color:"&day_color&"; color:000000;""> " & day_counter & " <font color=black>"&day_m&"</font></td>"
else calendar_html = calendar_html & "<td align=""center"" style=""background-color:ffffff; color:000000;""> " & day_counter & "<input name='rStay' type='checkbox' value="&month(this_month)&"/"&day_counter&"/"&year(this_month)&"></td>"
end if
week_day = week_day + 1
next
calendar_html = calendar_html & "</tr>"
calendar_html = calendar_html & "</table>"
Calendar = calendar_html
rs.close
set rs = nothing
Problem is this error
error '80020009'
Exception occurred.
/calendar2.asp, line 84
Whats the best loop for this .. keep in mind that each loop has to output the proper information concerning a specific day.
Idealy i would like to just loop through the recordset and output the proper cell HTML
Date is a date field abd the other 2 are bits (true false)
I am drawing a calendar and i want to loop through the record set as i draw every day to decide how to draw that day (aka red box if registerd is true and a "m" next to the day if that field is true)
here is what i have (dosent work)
calendar_html = calendar_html & "<tr>"
'Fill the first week of the month with the appropriate number of blanks.
for week_day = 0 to first_week_day - 1
calendar_html = calendar_html & "<td style=""background-color:333333; color:000000;""> </td>"
next
week_day = first_week_day
for day_counter = 1 to days_in_this_month
week_day = week_day mod 7
if week_day = 0 then
calendar_html = calendar_html & "</tr><tr>"
end if
Set rs = Server.CreateObject ("ADODB.Recordset")
SQL = "select * from reservations where year(reserved) = "&year(today)&" and month(reserved) = "&month(today)
rs.open SQL,"DSN=*******;uid=*******;pwd=*******"
'check to see if there are any dates
if not rs.EOF then
rs.movefirst
day_color="ffffff"
day_m=""
do until day(rs("reserved")) = day_counter <----- this is line 84
rs.movenext
loop
if rs("rStay") = "True" then day_color = "red"
if rs("mStay") = "True" then day_m = "m"
calendar_html = calendar_html & "<td align=""center"" style=""background-color:"&day_color&"; color:000000;""> " & day_counter & " <font color=black>"&day_m&"</font></td>"
else calendar_html = calendar_html & "<td align=""center"" style=""background-color:ffffff; color:000000;""> " & day_counter & "<input name='rStay' type='checkbox' value="&month(this_month)&"/"&day_counter&"/"&year(this_month)&"></td>"
end if
week_day = week_day + 1
next
calendar_html = calendar_html & "</tr>"
calendar_html = calendar_html & "</table>"
Calendar = calendar_html
rs.close
set rs = nothing
Problem is this error
error '80020009'
Exception occurred.
/calendar2.asp, line 84
Whats the best loop for this .. keep in mind that each loop has to output the proper information concerning a specific day.
Idealy i would like to just loop through the recordset and output the proper cell HTML