SqlCommand.EndExecuteReader(IAsyncResult) 方法

定義

完成非同步執行 Transact-SQL 語句,回傳請求 SqlDataReader的 。

public:
 System::Data::SqlClient::SqlDataReader ^ EndExecuteReader(IAsyncResult ^ asyncResult);
public System.Data.SqlClient.SqlDataReader EndExecuteReader(IAsyncResult asyncResult);
member this.EndExecuteReader : IAsyncResult -> System.Data.SqlClient.SqlDataReader
Public Function EndExecuteReader (asyncResult As IAsyncResult) As SqlDataReader

參數

asyncResult
IAsyncResult

他們IAsyncResult透過呼叫返回。BeginExecuteReader()

傳回

一個 SqlDataReader 可以用來檢索所請求資料列的物件。

例外狀況

asyncResult 參數為空(Nothing 在 Microsoft Visual Basic)

EndExecuteReader(IAsyncResult) 在單一指令執行中被呼叫超過一次,或是該方法與其執行方法不匹配(例如,程式碼呼叫 EndExecuteReader(IAsyncResult) 完成對 BeginExecuteXmlReader()的呼叫執行。

範例

關於示範該 EndExecuteReader 方法的範例,請參見 BeginExecuteReader

備註

當你呼叫 BeginExecuteReader 執行 Transact-SQL 語句時,必須呼叫 EndExecuteReader 才能完成該操作。 如果執行指令的過程尚未完成,此方法會阻塞直到操作完成。 使用者可以透過方法回傳BeginExecuteReaderIAsyncResult實例來驗證指令是否已完成操作。 若呼叫時指定 BeginExecuteReader了回調程序,則必須呼叫此方法。

適用於

另請參閱