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