Share via


SqlBatch.ExecuteReaderAsync(CancellationToken) Method

Definition

An asynchronous version of ExecuteReader() , which sends the Commands to the Connection and builds a SqlDataReader. Exceptions will be reported via the returned Task object.

public System.Threading.Tasks.Task<Microsoft.Data.SqlClient.SqlDataReader> ExecuteReaderAsync (System.Threading.CancellationToken cancellationToken = default);
override this.ExecuteReaderAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Data.SqlClient.SqlDataReader>
Public Function ExecuteReaderAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of SqlDataReader)

Parameters

cancellationToken
CancellationToken

A token to cancel the asynchronous operation.

Returns

A task representing the asynchronous operation.

Exceptions

An error occurred while executing the batch.

The CommandBehavior value is invalid.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to