PDA

Click to See Complete Forum and Search --> : delete current record


martialdc
Oct 29th, 2003, 04:06 AM
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?

CornedBee
Oct 29th, 2003, 04:12 AM
RowDeleted only checks if the row was deleted (I guess).

There must be some function like Delete or DeleteRow.

hellswraith
Oct 29th, 2003, 10:18 AM
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.

DevGrp
Oct 31st, 2003, 11:35 AM
Try this.

DataRow row = dataSet11.Tables["Student"]["myColumn"];
row.Delete();


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.