Day 11. Using Data Readers

As you learned yesterday, data readers are created using the ExecuteReader method of the command object. The data reader object that is returned implements the IDataReader and, typically, the IDataRecord interfaces to allow access to the data in a forward-only, read-only cursor-style object. As a result, data readers are ideal for scenarios in which you don't need to hold on to or cache the data and simply need to read through it quickly. In this way, data readers also reduce the overhead required because more than one row is never held in memory at any one time.

In today's short lesson, you'll look at the various ways you can work with data readers and how you can use them in your applications. Specifically, you'll ...

Get Sams Teach Yourself ADO.NET in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.