title: Merge DataRow to SQL Server database table
body: <p>In my SQL Server 2008 R2 database, I have an existing table <code>[dbo].[abc].[MyTable]</code>. Now I want to read the rows from my DataGridView and merge them into <code>MyTable</code>.</p>
  
  <p>Suppose I use a stored procedure.</p>
  
  <p>I have no idea for looping through and merging rows.</p>
  
  <p>Thanks for help.</p>
  
  <pre><code>private void saveRecords(DataGridView dgv)
  {
          foreach (DataGridViewRow row in dgv.Rows)
          {
              DataRow myRow = (row.DataBoundItem as DataRowView).Row;
              // merge it to table in database.
          }
  }
  </code></pre>