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


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).


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 ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.