Jyoti Jodha

Jyoti Jodha

  • NA
  • 1.7k
  • 406.5k

Input string was not in a correct format.

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