Querying for Resultsets Using DataReaders

Up to this point, this chapter has only covered invoking SQL commands that return one or no values from the database. When needing to return a resultset of multiple records, you would use the data provider–specific object that implements the IDataReader interface.

The IDataReader Interface

The IDataReader interface defines the ability to read streams of resultsets in a forward-only manner. The significance of this is one of performance.

DataReaders do not retrieve the entire resultset into memory immediately. Instead, the results are cached in a network buffer on the client. When needed, records are fetched and loaded into memory via the IDataReader.Read() method. One record is fetched at a time, thus ...

Get Delphi for .NET Developer’s Guide 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.