View Full Version : Easy one.. someone help

09-01-2005, 09: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;"">&nbsp;</td>"

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
do until day(rs("reserved")) = day_counter <----- this is line 84
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;"">&nbsp;" & day_counter & "&nbsp;<font color=black>"&day_m&"</font></td>"
else calendar_html = calendar_html & "<td align=""center"" style=""background-color:ffffff; color:000000;"">&nbsp;" & day_counter & "<input name='rStay' type='checkbox' value="&month(this_month)&"/"&day_counter&"/"&year(this_month)&"></td>"
end if
week_day = week_day + 1

calendar_html = calendar_html & "</tr>"
calendar_html = calendar_html & "</table>"

Calendar = calendar_html
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

09-01-2005, 10:05 PM

while day(rs("reserved")) <> day_counter

09-02-2005, 06:05 AM
You did not list what the DB field rs("reserved") is used for. Could it contain nulls that is making the Day() function fail?

09-02-2005, 06:08 AM
Hi aperseghin and welcome to the board!

And here's a related link that might hopefully give a clue:

Why do I get 80020009 errors?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum