DbDataReader.NextResultAsync 方法

定義

在讀取陳述式批次的結果時,以非同步方式將讀取器向前移到下一個結果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

多載

NextResultAsync()

在讀取陳述式批次的結果時,以非同步方式將讀取器向前移到下一個結果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

NextResultAsync(CancellationToken)

在讀取陳述式批次的結果時,以非同步方式將讀取器向前移到下一個結果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

備註

如需非同步程式設計的詳細資訊,請參閱 非同步程式設計For more information about asynchronous programming, see Asynchronous Programming.

NextResultAsync()

在讀取陳述式批次的結果時,以非同步方式將讀取器向前移到下一個結果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

public:
 System::Threading::Tasks::Task<bool> ^ NextResultAsync();
public System.Threading.Tasks.Task<bool> NextResultAsync ();
member this.NextResultAsync : unit -> System.Threading.Tasks.Task<bool>
Public Function NextResultAsync () As Task(Of Boolean)

傳回

Task<Boolean>

如果有多個結果集,則為 Result 屬性為 true 的工作;如果沒有,則為 falseA task whose Result property is true if there are more result sets or false if there aren't.

例外狀況

執行命令文字時發生錯誤。An error occurred while executing the command text.

備註

此非同步方法的預設執行會叫用其同步對應,並傳回已完成的工作,可能會封鎖呼叫執行緒。The default implementation of this asynchronous method invokes its synchronous counterpart and returns a completed Task, potentially blocking the calling thread.

支援 非同步程式設計 的資料提供者應該使用非同步 i/o 作業來覆寫預設的實值。Data providers that support asynchronous programming should override the default implementation using asynchronous I/O operations.

傳回的工作尚未完成時,不應該叫用 DbDataReader 物件的其他方法和屬性。Other methods and properties of the DbDataReader object should not be invoked while the returned Task is not yet completed.

適用於

NextResultAsync(CancellationToken)

在讀取陳述式批次的結果時,以非同步方式將讀取器向前移到下一個結果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

public:
 virtual System::Threading::Tasks::Task<bool> ^ NextResultAsync(System::Threading::CancellationToken cancellationToken);
public virtual System.Threading.Tasks.Task<bool> NextResultAsync (System.Threading.CancellationToken cancellationToken);
abstract member NextResultAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.NextResultAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Overridable Function NextResultAsync (cancellationToken As CancellationToken) As Task(Of Boolean)

參數

cancellationToken
CancellationToken

取消指令。The cancellation instruction.

傳回

Task<Boolean>

如果有多個結果集,則 Task<TResult>Result 屬性為 true;如果沒有,則為 falseA Task<TResult> whose Result property is true if there are more result sets or false if there aren't.

例外狀況

執行命令文字時發生錯誤。An error occurred while executing the command text.

備註

此非同步方法的預設執行會叫用其同步對應,並傳回已完成的工作,可能會封鎖呼叫執行緒。The default implementation of this asynchronous method invokes its synchronous counterpart and returns a completed Task, potentially blocking the calling thread. 如果傳遞的解除標記已取消,則預設執行也會傳回取消的工作。The default implementation also returns a cancelled task if passed an already cancelled cancellation token.

支援 非同步程式設計 的資料提供者應該使用非同步 i/o 作業來覆寫預設的實值。Data providers that support asynchronous programming should override the default implementation using asynchronous I/O operations.

這個方法會接受可以用來要求提早取消作業的取消語彙基元。This method accepts a cancellation token that can be used to request the operation to be cancelled early. 實作可以忽略這項要求。Implementations may ignore this request.

傳回的工作尚未完成時,不應該叫用 DbDataReader 物件的其他方法和屬性。Other methods and properties of the DbDataReader object should not be invoked while the returned Task is not yet completed.

適用於