Programatically Set or Change DataRow‘s RowState

Programatically Set or Change DataRow‘s RowState

The .NET Framework 2.0 adds a new feature: SetAdded, SetModified. You use this feature to set DataRow‘s RowState value programatically.

This is applicable only when the current DataRow‘s RowState is Unchanged.

Simply use the following steps:

  1. Make the necessary changes to the DataRow.
  2. Call AcceptChanges() for the DataRow. When invoking AcceptChanges, any DataRow object still in edit mode successfully ends its edit. Each DataRow‘s RowState property also changes; the Added and Modified rows become Unchanged, and the Deleted rows are removed:
  3. Set the RowState as desired:
See also  Small Business Strategies with Venmo

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist