Using RowError of the DataSet
To be much more efficient in responding to individual row error conditions, you can add error information to the row itself (even at the column level). The DataRow object allows you to do this by providing a RowError property for each row in the DataSet. As data rows are processed (for example, when updating them), you can set the RowError property for a row to indicate that it has an error. Then, simply use the HasErrors property to determine whether any error information has been added to any of the rows in the dataset. You can use the GetErrors method to return and examine only the rows with errors. It's all very slick.
Listing 13.3 is a short piece of code that adds a RowError condition to a particular row in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access