|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataTable.Rows.Remove not workingI am having application where i am filling datatable with one table of my database. After retrieving all records of table into datatable i want to delete some records depending on particular condition. So i used remove method as this is only method i found which is accepting row to be deleted instead of index. But after using remove method to delete rows, problem is coming at a time of saving changes into database using dataadapter. I used adapter.GetChanges(Rowstate.Deleted) to get information about those rows which are deleted using 'remove' method. But every time time this method is returning nothing and not list of deleted rows. Can someone tell me why this is happening. If someone knows any other alternative of deleting records without using index, then please tell me. Any help will be truely appreciated. Thanks in advance. trialproduct2004,
Remove completely removes the row from the datatable. So there is nothing there to indicate to the dataadapter that the row needs to be deleted from the database. Instead of Remove you need to use the DataRow's Delete method. Kerry Moorman Show quote "trialproduct2***@yahoo.com" wrote: > Hi all > > I am having application where i am filling datatable with one table of > my database. > > After retrieving all records of table into datatable i want to delete > some records depending on particular condition. > > So i used remove method as this is only method i found which is > accepting row to be deleted instead of index. > > But after using remove method to delete rows, problem is coming at a > time of saving changes into database using dataadapter. > > I used adapter.GetChanges(Rowstate.Deleted) to get information about > those rows which are deleted using 'remove' method. But every time time > this method is returning nothing and not list of deleted rows. > > Can someone tell me why this is happening. > > If someone knows any other alternative of deleting records without > using index, then please tell me. > > Any help will be truely appreciated. > > Thanks in advance. > > |
|||||||||||||||||||||||