if (e.ColumnIndex == dataGridView.Columns["Delete"].Index && e.RowIndex >= 0)
{
//dataGridView.Rows.RemoveAt(e.RowIndex);
int i = 1; con.Open();
SqlCommand cmd = new SqlCommand("delete from MainBillForm where Billno=" + Convert.ToInt16(dataGridView.Rows[e.RowIndex].Cells[1].Value), con);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
MessageBox.Show("Record Deleted Successfully!");
}
dataGridView.DataSource = null;
displayDataGridView();
}


Rafnas T PRank #280 · 8.8K reputationPosted May 15, 2017, 2:07 AM EDT
Rafnas T PRank #280 · 8.8K reputationPosted May 15, 2017, 12:31 AM EDT
Karthi KeyanRank #1,926 · 762 reputationPosted May 15, 2017, 1:13 AM EDT
ketan borsdiyaRank #2,258 · 624 reputationPosted May 15, 2017, 1:16 AM EDT
Sameer ShaikRank #1,825 · 812 reputationPosted May 15, 2017, 1:25 AM EDT
Rafnas T PRank #280 · 8.8K reputationPosted May 15, 2017, 1:36 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted May 15, 2017, 2:04 AM EDT