What is a DataReader?
A DataReader is a read-only stream of data returned from the database as the query executes. It only contains one row of data in memory at a time and is restricted to navigating forward only in the results one record at a time. The DataReader does support access to multiple result sets, but only one at a time and in the order retrieved. Just as in the original version of ADO, the data is no longer available through the DataReader once the connection to the data source is closed, which means a DataReader requires a connection to the database throughout its usage. Output parameters or return values are only available through the DataReader once the connection is closed. • Why DataReader Useful? Data Reader is Read only version Data Set,Each record is returned as a Data Reader Object,ExecuteReader method acts directly on the database connection. There are two versions of the data reader object: OleDbDataReader and SqlDataReader • Differnce B/w DataReader and DataSet The Dataset is an core