21.1 CommentsTroubleshooting

21.1 Comments/Troubleshooting

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.

Table 21-1. Provider-specific DataReader classes

Class

Data source

 System.Data.SqlClient.SqlDataReader 

SQL Server

 System.Data.OleDb.OleDbDataReader 

An OLE DB provider

 System.Data.Odbc.OdbcDataReader 

An ODBC driver

 System.Data.OleDb.OracleDataReader 

Oracle



ADO. NET in a Nutshell
ADO.NET in a Nutshell
ISBN: 0596003617
EAN: 2147483647
Year: 2005
Pages: 415

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net