title: How to delete one to mutlply rows at one time by selecting check box in datagridview in c#
body: <p>I am having trouble with deleting one to multiply rows in <code>DataGridView</code> by selecting check box and clicking the delete button. When i click the delete button nothing happens and neither appears if there is an error. </p>
  
  <p>Here is my code</p>
  
  <pre><code>SqlConnection cn = new SqlConnection("Data Source=.\\SQLEXPRESS; Initial Catalog=DatabaseName;Integrated Security=True");
      SqlCommand cmd = new SqlCommand();
      SqlDataReader dr;
  
  
  private void btnDeleteCust_Click(object sender, EventArgs e)
  {
      foreach (DataGridViewRow item in gridCustomer.Rows)
      {
          if (bool.Parse(item.Cells[6].Value.ToString()))
          {
              cn.Open();
              cmd.CommandText = "delete from Customer where customerID = '" + item.Cells[0].Value.ToString() + "'";
              cmd.ExecuteNonQuery();
  
              cn.Close();
          }
      }
  }
  </code></pre>