Chapter 9: Using DataReader Objects to Read Results

Overview

Reading rows using a DataReader object (sometimes known as a firehose cursor) is typically faster than reading from a DataSet. DataReader objects are part of the managed providers, and there are three DataReader classes: SqlDataReader, OleDbDataReader, and OdbcDataReader. You use a DataReader object to read rows retrieved from the database using a Command object.

DataReader objects can be used to read rows only in a forward direction. DataReader objects act as an alternative to a DataSet object (DataSet objects allow you to store a copy of the rows from the database, and you can work with that copy while disconnected from the database). You cannot use a DataReader to modify rows in the database.

Featured in this chapter:

  • The SqlDataReader class

  • Creating a SqlDataReader object

  • Reading rows from a SqlDataReader object

  • Returning strongly typed column values

  • Reading null values

  • Executing multiple SQL statements

  • Using a DataReader object in Visual Studio .NET




Mastering C# Database Programming
Mastering the SAP Business Information Warehouse: Leveraging the Business Intelligence Capabilities of SAP NetWeaver
ISBN: 0764596373
EAN: 2147483647
Year: 2003
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net