7
Reply

Input string was not in a correct format.

Jyoti Jodha

Jyoti Jodha

May 15 2017 4:27 AM
252
 
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();
}
 

Answers (7)