title: How to get pass this error "Value cannot be null. Parameter name: entity"
body: <pre><code>        private void button1_Click(object sender, EventArgs e)
      {
  
          DataClasses1DataContext dc = new DataClasses1DataContext();
          var rec = dc.reportsSents.FirstOrDefault();
          int rowCount = dc.reportsSents.Count();
  
  
          if (rec != null)
              {
  
              for(int i = 0; i &lt;= rowCount;)
                  {
  
  
                      var matchedCaseNumber = (from CaseNumberKey in dc.GetTable&lt;reportsSent&gt;()
                                       select CaseNumberKey).FirstOrDefault();
  
                      (new MyReportRenderer()).RenderTest(Convert.ToString(matchedCaseNumber));
  
                      dc.reportsSents.DeleteOnSubmit(matchedCaseNumber);
                      dc.SubmitChanges();
  
                      i = (i +1);
  
                  } 
  
               }  
  </code></pre>
  
  <p>When the code above is executed I get this error:</p>
  
  <blockquote>
    <p>Value cannot be null. Parameter name:
    entity</p>
  </blockquote>
  
  <p>and matchedCaseNumber is highlighted in this line:</p>
  
  <p>dc.reportsSents.DeleteOnSubmit(matchedCaseNumber); </p>
  
  <p>What does this mean and why am I getting it.  What I am trying to do is pass MatchedCaseNumber to the method and then delete it after the method is executed and then step through the table.  Any help would be appreciated.</p>
  
  <p>Thanks.</p>