There are two basic techniques for reading data in ADO.NET: using data readers and datasets. Additionally, data may be read from either a backend DBMS, such as SQL Server, or from a simple (or complex) XML file. In the next several sections, we’ll discuss these techniques and data sources.
The following sections describe the use of data readers and datasets, provide an example, and discuss why one would use one technique over the other.
The data reader technique consists of using
an instance of either the SqlDataReader or
class to retrieve the data in a similar
fashion to a forward-only, read-only database cursor. Data readers
provide lightweight access to data that is recommended when
retrieving data for display in a Web Forms page or for other
circumstances in which the overhead of a dataset is not desirable.