Version

GetReader(IDbCommand,CommandBehavior) Method

Gets an IDataReader for a database selection with specified behavior.
Syntax
'Declaration
 
Protected Overloads Function GetReader( _
   ByVal currentCommand As IDbCommand, _
   ByVal behavior As CommandBehavior _
) As IDataReader
protected IDataReader GetReader( 
   IDbCommand currentCommand,
   CommandBehavior behavior
)

Parameters

currentCommand
An IDbCommand specifying either a text command based on a SELECT statement, or a stored procedure returning multiple records.
behavior
The CommandBehavior when the IDataReader returned from this method becomes exhausted.

Return Value

An IDataReader open for forward-only, firehose reading access to a command's result set. Returns null (or Nothing) if an error occured while attempting to execute currentCommand.
Remarks

Inheritors may retrieve an IDataReader for use with an IDbCommand they've initialized in their own implementation of a fetch operation method through this method. The caller can specify the command behavior that takes place when the IDataReader exhausts itself.

If the Connection was not open before calling this method, then this method will open it (certain behaviors such as CloseConnection will effectively close the connection when you are through with this data reader) because calling Read on a data reader while the connection is closed is not allowed.

Inheritors must not allow this method to be called prior to the initialization and establishment of a good Connection. This shouldn't be a problem as long as GetReader is only called during data binding operations.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also