I use this code to delete the current record in my C# Project.
dataSet11.Tables["Student"].RowDeleted;
But it doesn't work. What code should I write?
Printable View
I use this code to delete the current record in my C# Project.
dataSet11.Tables["Student"].RowDeleted;
But it doesn't work. What code should I write?
RowDeleted only checks if the row was deleted (I guess).
There must be some function like Delete or DeleteRow.
And remember, once you delete a row in a dataset, you are only flagging it for deletion. It won't actually be deleted until you update the datasource with the dataset.
Try this.
This may not be the correct code (i cant test it) but it should be similar. Get a reference o the row you want to delete then call the delete function on the row object which marks the row for deletion then update the DB.Code:DataRow row = dataSet11.Tables["Student"]["myColumn"];
row.Delete();