DbCommand.ExecuteReaderAsync 方法
定义
ExecuteReader 的异步版本,针对 CommandText 和 Connection 执行 DbDataReader。An asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader.
重载
注解
托管提供程序实现者必须 ExecuteDbDataReaderAsync 在中调用 ExecuteReaderAsync 。Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. 有关异步编程的详细信息,请参阅 异步编程。For more information about asynchronous programming, see Asynchronous Programming.
ExecuteReaderAsync()
ExecuteReader 的异步版本,针对 CommandText 和 Connection 执行 DbDataReader。An asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader.
通过 CancellationToken.None 调用 ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken)。Invokes ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) with CancellationToken.None.
public:
System::Threading::Tasks::Task<System::Data::Common::DbDataReader ^> ^ ExecuteReaderAsync();
public System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteReaderAsync ();
member this.ExecuteReaderAsync : unit -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Public Function ExecuteReaderAsync () As Task(Of DbDataReader)
返回
表示异步操作的任务。A task representing the asynchronous operation.
例外
执行命令文本时出现的一个错误。An error occurred while executing the command text.
无效的 CommandBehavior 值。An invalid CommandBehavior value.
注解
托管提供程序实现者必须 ExecuteDbDataReaderAsync 在中调用 ExecuteReaderAsync 。Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. 有关异步编程的详细信息,请参阅 异步编程。For more information about asynchronous programming, see Asynchronous Programming.
另请参阅
适用于
ExecuteReaderAsync(CommandBehavior)
ExecuteReader 的异步版本,针对 CommandText 和 Connection 执行 DbDataReader。An asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader.
调用 ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).Invokes ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).
public:
System::Threading::Tasks::Task<System::Data::Common::DbDataReader ^> ^ ExecuteReaderAsync(System::Data::CommandBehavior behavior);
public System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteReaderAsync (System.Data.CommandBehavior behavior);
member this.ExecuteReaderAsync : System.Data.CommandBehavior -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Public Function ExecuteReaderAsync (behavior As CommandBehavior) As Task(Of DbDataReader)
参数
- behavior
- CommandBehavior
指定了命令行为的枚举值之一。One of the enumeration values that specified the command behavior.
返回
表示异步操作的任务。A task representing the asynchronous operation.
例外
执行命令文本时出现的一个错误。An error occurred while executing the command text.
无效的 CommandBehavior 值。An invalid CommandBehavior value.
注解
托管提供程序实现者必须 ExecuteDbDataReaderAsync 在中调用 ExecuteReaderAsync 。Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. 有关异步编程的详细信息,请参阅 异步编程。For more information about asynchronous programming, see Asynchronous Programming.
另请参阅
适用于
ExecuteReaderAsync(CancellationToken)
ExecuteReader 的异步版本,针对 CommandText 和 Connection 执行 DbDataReader。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.
调用 ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).Invokes ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken).
public:
System::Threading::Tasks::Task<System::Data::Common::DbDataReader ^> ^ ExecuteReaderAsync(System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteReaderAsync (System.Threading.CancellationToken cancellationToken);
member this.ExecuteReaderAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Public Function ExecuteReaderAsync (cancellationToken As CancellationToken) As Task(Of DbDataReader)
参数
- cancellationToken
- CancellationToken
用于取消异步操作的令牌。A token to cancel the asynchronous operation.
返回
表示异步操作的任务。A task representing the asynchronous operation.
例外
执行命令文本时出现的一个错误。An error occurred while executing the command text.
无效的 CommandBehavior 值。An invalid CommandBehavior value.
注解
托管提供程序实现者必须 ExecuteDbDataReaderAsync 在中调用 ExecuteReaderAsync 。Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. 有关异步编程的详细信息,请参阅 异步编程。For more information about asynchronous programming, see Asynchronous Programming.
另请参阅
适用于
ExecuteReaderAsync(CommandBehavior, CancellationToken)
public:
System::Threading::Tasks::Task<System::Data::Common::DbDataReader ^> ^ ExecuteReaderAsync(System::Data::CommandBehavior behavior, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteReaderAsync (System.Data.CommandBehavior behavior, System.Threading.CancellationToken cancellationToken);
member this.ExecuteReaderAsync : System.Data.CommandBehavior * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Public Function ExecuteReaderAsync (behavior As CommandBehavior, cancellationToken As CancellationToken) As Task(Of DbDataReader)
参数
- behavior
- CommandBehavior
用于指定命令行为的枚举值之一。One of the enumeration values that specifies the command behavior.
- cancellationToken
- CancellationToken
用于取消异步操作的令牌。A token to cancel the asynchronous operation.
返回
表示异步操作的任务。A task representing the asynchronous operation.
例外
执行命令文本时出现的一个错误。An error occurred while executing the command text.
无效的 CommandBehavior 值。An invalid CommandBehavior value.
注解
托管提供程序实现者必须 ExecuteDbDataReaderAsync 在中调用 ExecuteReaderAsync 。Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. 有关异步编程的详细信息,请参阅 异步编程。For more information about asynchronous programming, see Asynchronous Programming.