Most ADO.NET providers include a strongly typed
DataReader
.
Every DataReader
implements two interfaces:
IDataReader
(which defines the core reader
functionality) and IDataRecord
(which allows you
to access the current record values). Because
IDataReader
extends
IDataRecord
, you can use the
IDataReader
to access all the
IDataRecord
and IDataReader
functionality when writing provider-agnostic data access code.
Strongly typed DataReader
objects typically add
type-safe methods that allow you to retrieve column values as
database-specific data types. Some DataReader
classes for ADO.NET providers are shown in Table 21-1.