title: How to update a value in a column in a datatable which is in a foreachloop?
body: <p>I want to update all columns one by one in a datatable using a foreach loop. The code below is what I have so far. But it does not seem to work. Your help will be much appreciated. </p>
  
  <pre><code> foreach (DataRow row in myTable.Rows) 
   {
       Double i;
       Double j = Convert.ToDouble(row["x"]);
       int y = 1;
  
       int aan = (int)row["year"];
  
           if(y == aan) 
           {
              i = j + 2;
           }
  
       row["x"]=i;
       row.EndEdit();
       myTable.AcceptChanges();
  
    }
  </code></pre>