Storing Data in Memory in Microsoft ADO.NET 4
- 10/25/2010
- Adding Data
- Examining and Changing Data
- Removing Data
- Batch Processing
- Validating Changes
- Summary
- Chapter 3 Quick Reference
Chapter 3 Quick Reference
To |
Do This |
Add a row to a DataTable |
Use the DataTable object’s NewRow method to obtain a DataRow instance. Update the Item values in the DataRow as needed. Add the row using the table’s Rows.Add method. |
Delete a row from a DataTable |
Call the DataRow object’s Delete method. Call the DataTable object’s AcceptChanges method. |
Check for data issues in new and modified DataRow objects |
Create a DataTable. Add DataColumn definitions as needed. Add event handlers for the DataTable object’s ColumnChanging, RowChanging, or other events. In the handlers, call the DataRow object’s SetColumnError method or update its RowError property. |
Temporarily suspend data validation while modifying a data row |
Call the DataRow object’s BeginEdit method. Update the Item values in the DataRow as needed. Call the DataRow object’s EndEdit method. |