title: how to implement a unique key when add a new record in a datagridview
body: <p>I have 2 order tables(master/detail). 1 is the order header, another one is in detail. 2 tables are linked (master.key_seq = detail.link_key_seq).
  I just dragged this two table to a form as datagridviews. This form is working properly with update/insert/delete from sql server. 
  How can I implement a unique key number when I press the "add" button from the bindingNavigator ? </p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows.Forms;
      using System.Data.SqlClient;
  
      namespace TestConnect
      {
          public partial class Form1 : Form
          {
              public Form1()
              {
                  InitializeComponent();
              }
          private void mPO_MASTERBindingNavigatorSaveItem_Click(object sender, EventArgs e)
              {
                  this.Validate();
                  this.mPO_MASTERBindingSource.EndEdit();
                 this.tableAdapterManager.UpdateAll(this.vGB_PurchaseDataSet);
              }
  
      private void Form1_Load(object sender, EventArgs e)
          {
          // TODO: This line of code loads data into the 'vGB_PurchaseDataSet.MPO_DETAIL' table. You can move, or remove it, as needed.
          this.mPO_DETAILTableAdapter.Fill(this.vGB_PurchaseDataSet.MPO_DETAIL);
          // TODO: This line of code loads data into the 'vGB_PurchaseDataSet.MPO_MASTER' table. You can move, or remove it, as needed.
          this.mPO_MASTERTableAdapter.Fill(this.vGB_PurchaseDataSet.MPO_MASTER);
          }
  
      private void DeleteBtn_Click(object sender, EventArgs e)
          {
          foreach (DataGridViewRow item in this.mPO_DETAILDataGridView.SelectedRows)
          {
              mPO_DETAILDataGridView.Rows.RemoveAt(item.Index);
          }
          }
      }
      }
  </code></pre>