- Basic Concepts
- DataRow represents a row in DataTable from System.Data namespace
- DataTable is populated with DataRows using Add method
- Object array must match number of DataColumn fields
- Row Operations
- Get first row using Rows[0], last row by subtracting 1 from Count
- Loop through ItemArray to access each field
- Remove removes row, Delete removes and returns next row
- Advanced Features
- Field generic method returns strongly-typed fields without casting
- RemoveAt method removes row at specified index
- Exceptions help debug but should not be overused
- Usage
- DataRow is essential in DataTable-based programs
- Object arrays can store any element type
- Field method provides clearer code for complex data access