Can a RowState property be changed?

  • Thread starter Thread starter BStorm
  • Start date Start date
Hi BStorm,

BStorm said:
Is it possible to change individual RowState properties from updated to not
updated?

I'm pretty sure DataRow.AcceptChanges will do the trick. If you actually
wanted to reverse the changes in addition to resetting the RowState you
would call DataRow.RejectChanges.

Regards,
Dan
 
Hi,

You cannot directly change RowState, it's a read only property, its value
is update depending of what you did with the Row.

Cheers,
 
I understand. The problem is this is universal. There may be situations
where it might be desirable to examine specific changes after the fact (such
as one I am dealing with now) and saying yea or nea at that point.
 
Hi BStorm,

BStorm said:
I understand. The problem is this is universal. There may be situations
where it might be desirable to examine specific changes after the fact (such
as one I am dealing with now) and saying yea or nea at that point.

You replied to my post, but the above only makes sense (to me) as a
response to Ignacio's post. In any case, I'm still pretty sure that
..AcceptChanges or .RejectChanges will do what you want, depending on whether
you want to only reset the row state or reset the field values as well.

Regards,
Dan
 
AcceptChanges applies to ALL changes in the DataSet as a set, I believe.
IOW, there is no granularity to this method as far as I can tell. Or is it
possible to do it on a per/row basis?
 
Hi BStorm,

BStorm said:
AcceptChanges applies to ALL changes in the DataSet as a set, I believe.
IOW, there is no granularity to this method as far as I can tell. Or is it
possible to do it on a per/row basis?

From the documentation for DataRow.AcceptChanges (which I referenced
earlier in this thread):

"Commits all the changes made to this row since the last time
AcceptChanges was called."

And also:

"When invoking AcceptChanges, the EndEdit method is implicitly
called to end any edits. If the RowState of the row was Added or Modified,
the RowState becomes Unchanged. If the RowState was Deleted, the row is
removed."

Keep in mind that AcceptChanges will *not* revert the fields to their
original values and *will* remove the DataRow from the rows collection if
the RowState is Deleted. In other words, you are doing exactly what the
DataAdapter does when you call Update, but *without* actually updating the
database. If you really want "undo" functionality then you should use
RejectChanges instead.

Regards,
Dan
 
Back
Top