I was trying to populate a table with dates for a whole year except Sundays. Following is my code.
for (int i = 0; i < 365; i++)
        {
            if ( b <= 6)
            {
                cmd.Parameters["@Shift"].Value = "S" + b.ToString();
            }
            b++;
            if (b > 6)
                b = 1;
            if (date.DayOfWeek != DayOfWeek.Sunday)
            {
                cmd.Parameters["@Date"].Value = date.ToString("d");
            }
            date = date.NextDay();
            sqlConn.Open();
            cmd.ExecuteNonQuery();
            sqlConn.Close();
        }
I'm using the extension method from http://fluentdatetime.codeplex.com/.
The problem is, when the rows are inserted, everything is correct except the date before a Sunday is repeated.
For example,
    4/28/2011 < Thu 
    4/29/2011 < Fri
    4/30/2011 < Sat 
    4/30/2011 < Sat
    5/2/2011  < Mon
Where did I go wrong?
PS. When I try to figure out with breakpoints and soon as the pointer reaches sqlConn.Open(), Visual Studio 2010 says "No Source Available".
 
    