ExecuteReaderAsync Method (CancellationToken)

DbCommand.ExecuteReaderAsync Method (CancellationToken)

.NET Framework 4.6 and 4.5

An asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader. This method propagates a notification that operations should be canceled.

Invokes ExecuteDbDataReaderAsync.

Namespace:   System.Data.Common
Assembly:  System.Data (in System.Data.dll)

Public Function ExecuteReaderAsync (
	cancellationToken As CancellationToken
) As Task(Of DbDataReader)


Type: System.Threading.CancellationToken

The token to monitor for cancellation requests.

Return Value

Type: System.Threading.Tasks.Task(Of DbDataReader)

A task representing the asynchronous operation.

Exception Condition

An error occurred while executing the command text.


An invalid CommandBehavior value.

Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. For more information about asynchronous programming, see Asynchronous Programming.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.5
Return to top
© 2015 Microsoft