title: C# OleDBConnection Excel
body: <p>Following on from this question <a href="https://stackoverflow.com/questions/5648308/c-oledbconnection-to-excel">C# OLEDBConnection to Excel</a></p>
  
  <p>I am having issues with using OLEdbCommandBuilder.
  I have this code:</p>
  
  <pre><code> DataTable dt = new DataTable();
              OleDbCommand command = new OleDbCommand();
  
              command = new OleDbCommand("Select * from [working sheet$]", oleDBConnection);
              OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
              dataAdapter.SelectCommand = command;
  
              OleDbCommandBuilder c = new OleDbCommandBuilder(dataAdapter);
  
              dataAdapter.Fill(dt);
  
              //arbitrary changed datatable
              dt.Rows[2][3] = "dfd";
  
              c.GetUpdateCommand();
  
              dataAdapter.Update(dt);
  
              oleDBConnection.Close();
  </code></pre>
  
  <p>However when I run it, I get this error:</p>
  
  <pre><code>Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
  </code></pre>
  
  <p>How can I update the Excel sheet with the updated row/cell information?  I've never had to deal with Excel in such a way before.</p>
  
  <p>I've googled the error but cannot find anything that meets my exact requirements.</p>
  
  <p>Thanks,</p>
  
  <p>Darren.</p>