Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Understanding the Delete and Remove methods - datarow object

Posted on 2007-10-04
Medium Priority
Last Modified: 2012-06-21
In a DataRow object we have the methods Delete and Remove.
The Delete method marks the row for deletion by changing the RowState property to Delete and hidding the row.
My question is about the Remove method.
It says that it completely revomes the row from the DataRowCollection, but what happens with that row when we save the changes in the dataset to the database?
In understand perfectly what happens when we use the Delete method, but the Remove method is not clear to me.
Also, if we use the Delete method, the row will be hidden and changed to Delete state. How can I undo this operation and bring the row back to its original state?

Question by:andrepires
  • 2
LVL 16

Accepted Solution

RobertRFreeman earned 2000 total points
ID: 20018386
The Remove method removes the row from the datatable, so when you do an update, it doesn't do anything to that row (will not delete from database).  If it's deleted, then when you do an update, the deletecommand on your adapter is used (deletes from database).
LVL 16

Expert Comment

ID: 20018394
Use RejectChanges to restore the row.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question