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 PPosted May 15, 2017, 12:08 AM
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 PPosted May 15, 2017, 12:48 AM
Jyoti JodhaPosted May 15, 2017, 12:43 AM
Karthi KeyanPosted May 13, 2017, 6:37 AM
Jyoti JodhaPosted May 13, 2017, 4:59 AM
Rafnas T PPosted May 13, 2017, 4:49 AM