how to delete data from datagridview delete all billno records in Database use windows application c#
|
ID |
Billno |
Product name |
tax |
Total Amount |
delete |
|
1` |
1 |
Abc |
800 |
2100 |
delete |
|
2 |
2 |
Xyz |
150 |
1097 |
delete |
|
3 |
3 |
Asd |
556 |
4556565 |
delete |
In Gridview Records
In Database Records
|
Id |
Billno |
Product name |
Amount |
Tax |
Total amount |
|
1 |
1 |
Abc |
500 |
500 |
1000 |
|
2 |
1 |
Abc |
800 |
300 |
1100 |
|
3 |
1 |
Abc |
1300 |
800 |
2100 |
|
4 |
2 |
Xyz |
200 |
50 |
250 |
|
5 |
2 |
Xyz |
897 |
100 |
997 |
|
6 |
2 |
xyz |
1097 |
150 |
1247 |
|
7 |
3 |
Asd |
5000 |
525 |
5252 |


Rafnas T PRank #280 · 8.8K reputationPosted May 14, 2017, 8:08 PM EDT
SqlCommand cmd= new SqlCommand("delete from tablename where Billno=" + Convert.ToInt16(dataGridView.Rows[e.RowIndex].Cells[1].Value), con);
int count=cmd.ExecuteNonQuery();
Rafnas T PRank #280 · 8.8K reputationPosted May 13, 2017, 12:49 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted May 13, 2017, 12:59 AM EDT
Karthi KeyanRank #1,926 · 762 reputationPosted May 13, 2017, 2:37 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted May 14, 2017, 8:43 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted May 14, 2017, 8:48 PM EDT