title: Adding rows from a datagridview to an sql database
body: <p>I have a DataGridView which I populate with variables, however I would then Like to add each row to a sql database table.</p>
  
  <p>At the moment I am trying this code when a button is pressed, however I am a bit stuck on what my values should be.... here is my code... Am I on the right track, even though I have just thrown code together.</p>
  
  <pre><code>///////// Add to DataGridView Rows to Table ///////
          foreach( DataGridViewRow row in dgv.Rows){
          SqlCommand Insert = new SqlCommand(@"insert into TestTable(ID, FirstName, LastName) values ("dgv.Cells[1].Value.ToString(), dgv.Cells[2].Value.ToString(),dgv.Cells[3].Value.ToString());
          }
  </code></pre>