O'Reilly logo

Visual Basic 2008 Recipes: A Problem-Solution Approach by Rakesh Rajan, Matthew MacDonald, Allen Jones, Todd Herman

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

8.7. Process the Results of a SQL Query Using a Data Reader

Problem

You need to process the data contained in the System.Data.DbDataReader class instance returned when you execute the DbCommand.ExecuteReader method (see recipe 8-5).

Solution

Use the members of the DbDataReader class to move through the rows in the result set sequentially and access the individual data items contained in each row.

How It Works

The DbDataReader class represents a data reader, which is a forward-only, read-only mechanism for accessing the results of a SQL query. This is a MustInherit class that implements both the System.Data.IDataReader and System.Data.IDataRecord interfaces. Each data provider includes a unique DbDataReader implementation. Here is the list of ...

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