private void button1_Click(object sender, EventArgs e)
{
if (objConn1.State != ConnectionState.Open)
{
objConn1.Open();
}
for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
{
DialogResult result;
result = MessageBox.Show("Are You sure want to Delete?", "Conformation", MessageBoxButtons.YesNo);
if (result == System.Windows.Forms.DialogResult.Yes)
{
SqlCommand command = new SqlCommand("UPDATE SAPProduction.ProductionData_BK SET Rejection = @Reject Where id = '" + dataGridView1.CurrentRow.Cells["id"].Value.ToString() + "' ", objConn1);
command.Parameters.AddWithValue("@Reject", dataGridView1.CurrentRow.Cells["Rejection"].Value.ToString());
command.ExecuteNonQuery();
objConn1.Close();
}
}
}