title: Updating Cells in a DataTable
body: <p>I'm writing a small app to do a little processing on some cells in a CSV file I have. I've figured out how to read and write CSV files with a library I found online, but I'm having trouble: the library parses CSV files into a DataTable, but, <strong>when I try to change a cell of the table, it isn't saving the change in the table!</strong></p>
  
  <p>Below is the code in question. I've separated the process into multiple variables and renamed some of the things to make it easier to debug for this question.</p>
  
  <h2>Code</h2>
  
  <p>Inside the loop:</p>
  
  <pre><code>string debug1 = readIn.Rows[i].ItemArray[numColumnToCopyTo].ToString();
  string debug2 = readIn.Rows[i].ItemArray[numColumnToCopyTo].ToString().Trim();
  string debug3 = readIn.Rows[i].ItemArray[numColumnToCopyFrom].ToString().Trim();
  string towrite = debug2 + ", " + debug3;
  readIn.Rows[i].ItemArray[numColumnToCopyTo] = (object)towrite;
  </code></pre>
  
  <p>After the loop:</p>
  
  <pre><code>readIn.AcceptChanges();
  </code></pre>
  
  <hr>
  
  <p>When I debug my code, I see that <em>towrite</em> is being formed correctly and everything's OK, except that the row isn't updated: why isn't it working? I have a feeling that I'm making a simple mistake here: the last time I worked with DataTables (quite a long time ago), I had similar problems.</p>
  
  <p>If you're wondering why I'm adding another comma in <em>towrite</em>, it's because I'm combining a street address field with a zip code field - I hope that's not messing anything up.</p>
  
  <p>My code is kind of messy, as I'm only trying to edit one file to make a small fix, so sorry.</p>