Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Easy one.. someone help

    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)

    Code:
    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>"   
             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;"">&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
             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
    Last edited by aperseghin; 09-01-2005 at 08:29 PM.

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    try
    Code:
    while day(rs("reserved")) <> day_counter 
    				rs.movenext			
    				wend

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You did not list what the DB field rs("reserved") is used for. Could it contain nulls that is making the Day() function fail?
    Robert
    Gee! Web Tools
    Web Content Management / Internet Marketing modules including:
    Page Editor - Calendar Manager - News Editor - Contact Organizer - Mail Wizard

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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?
    http://www.aspfaq.com/show.asp?id=2421
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •