12.5. DataReader class

Earlier in this chapter we defined a DataReader class as one that supports reading a forward-only stream of data rows from a data source. Both managed providers implement the IDataReader interface and inherit the following properties.

  • Depth Returns the level of nesting for the current row as an Integer value.

  • IsClosed This Boolean property indicates whether or not the data reader is closed.

  • RecordsAffected Returns the number of rows (as an Integer value) changed, inserted, or deleted by the execution of the SQL statement. If no rows are affected or the statement fails, this property will be set to 0, and for SELECT statements this property will be set to –1.

OleDbDataReader and SqlDataReader classes also have the following ...

Get A Programmer's Guide to .NET 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.