O'Reilly logo

Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition by David Sceppa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with the SqlDataReader

The SqlCommand class is designed to help you construct your queries. As shown earlier in the chapter, calling the ExecuteReader method on a SqlCommand object returns a SqlDataReader object, which you can use to retrieve the rows returned by those queries.

The SqlDataReader class is similar to other reader classes in the .NET Framework, such as the XmlReader, TextReader, and StreamReader classes. Each of these classes provides an efficient, lightweight object that lets you examine (in a read-only fashion) the data that the object exposes. The TextReader class, for example, has methods that let you read the contents of a text file one line at a time. Similarly, the SqlDataReader exposes properties and methods that let ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required