title: Loop within a date range for each month and each day
body: <p>I have two text-boxes which are used to select a From and a To date. I need to have a loop where the outer loop will be for a year and the inner loop will run for each month.</p>
  
  <p>Problem is with the code below, if I choose 11/01/2011 and 06/30/2012, my month loop runs once for month 11. After that the loop exits.. Any help is appreciated.</p>
  
  <p>I'm using the code below to look into a SharePoint Calendar List (using CAML query) and fetch number of times 3, 5 consecutive days a certain room is available excluding week ends. Idea is to use CAML query to get the number of free days for each month and keep repeating till the last selected month.</p>
  
  <pre><code>int year = 0, month = 0; 
  for (year = Calendar1.SelectedDate.Year; year &lt;= Calendar2.SelectedDate.Year; year++)
  {
    int i = year;
    for (month = Calendar1.SelectedDate.Month; month &lt;= Calendar2.SelectedDate.Month; month++)
    {
      int j = month;
    }
  }
  </code></pre>