title: C# - Using DataAdapter to Update SQL table from a DataTable - SQL table not updating
body: <p>I <code>select * from</code> an Excel spreadsheet into <code>DataTable</code> <code>dt</code>. I want to take those values and update the SQL table. The SQL table exists because of a manual import to SQL from the original Excel spreadsheet, has a primary key set. The user updates the excel sheet and I need to update the SQL values. I am setting the <code>dt.RowState</code> to modified in an effort to invoke the update. I get no error but the SQL table does not update. Previous test show my SQL permissions and connection is good, I can modify the table.</p>
  <pre><code>connectionToSQL = new SqlConnection(SQLConnString);
  connectionToSQL.Open();
  var cmd = new SqlCommand(&quot;SELECT * FROM TAGS$&quot;,connectionToSQL);                 
  var da = new SqlDataAdapter(cmd);
  var b = new SqlCommandBuilder(da);
  foreach (DataRow r in dt.Rows)
  {
      r.SetModified();
  }
  da.Update(dt);   
  </code></pre>