Språk

SqlBatch.ExecuteDbDataReader(CommandBehavior) Method

Definition

Executes the batch against its connection, returning a SqlDataReader which can be used to access the results.

protected:
 virtual System::Data::Common::DbDataReader ^ ExecuteDbDataReader(System::Data::CommandBehavior behavior);
protected:
 override System::Data::Common::DbDataReader ^ ExecuteDbDataReader(System::Data::CommandBehavior behavior);
protected virtual System.Data.Common.DbDataReader ExecuteDbDataReader(System.Data.CommandBehavior behavior);
protected override System.Data.Common.DbDataReader ExecuteDbDataReader(System.Data.CommandBehavior behavior);
abstract member ExecuteDbDataReader : System.Data.CommandBehavior -> System.Data.Common.DbDataReader
override this.ExecuteDbDataReader : System.Data.CommandBehavior -> System.Data.Common.DbDataReader
override this.ExecuteDbDataReader : System.Data.CommandBehavior -> System.Data.Common.DbDataReader
Protected Overridable Function ExecuteDbDataReader (behavior As CommandBehavior) As DbDataReader
Protected Overrides Function ExecuteDbDataReader (behavior As CommandBehavior) As DbDataReader

Parameters

behavior
CommandBehavior

An instance of CommandBehavior, specifying options for batch execution and data retrieval. Only SequentialAccess and CloseConnection are supported at the batch level.

Returns

A DbDataReader object.

Exceptions

An error occurred while executing the batch.

The CommandBehavior value is invalid.

Remarks

When the batch returns multiple result sets from different commands, NextResult() can be used to advance the reader to the next result set.

Note

This method benefits from ExecuteReader(CommandBehavior), and all the expected exceptions of that method also apply here.

Applies to