SqlCommand.EndExecuteXmlReader(IAsyncResult) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
完成 Transact-SQL 陳述式的非同步執行,以 XML 傳回要求的資料。
public:
System::Xml::XmlReader ^ EndExecuteXmlReader(IAsyncResult ^ asyncResult);
public System.Xml.XmlReader EndExecuteXmlReader(IAsyncResult asyncResult);
member this.EndExecuteXmlReader : IAsyncResult -> System.Xml.XmlReader
Public Function EndExecuteXmlReader (asyncResult As IAsyncResult) As XmlReader
參數
- asyncResult
- IAsyncResult
呼叫 IAsyncResult 所傳回的 BeginExecuteXmlReader()。
傳回
可用來擷取所產生之 XML 資料的 XmlReader 物件。
例外狀況
asyncResult 參數為 null (在 Microsoft Visual Basic 中為 Nothing)
呼叫多次 EndExecuteXmlReader(IAsyncResult) 來執行單一命令,或方法不符合其執行方法 (例如程式碼呼叫了 EndExecuteXmlReader(IAsyncResult) 來完成執行 BeginExecuteNonQuery() 呼叫)。
範例
如需示範如何使用 方法的 EndExecuteXmlReader 範例,請參閱 BeginExecuteXmlReader。
備註
當您呼叫 BeginExecuteXmlReader 以執行 Transact-SQL 語句時,必須呼叫 EndExecuteXmlReader 才能完成作業。 如果執行命令的程式尚未完成,這個方法會封鎖直到作業完成為止。 使用者可以使用 方法傳回的 BeginExecuteXmlReader 實例,確認命令已完成其作業IAsyncResult。 如果在呼叫 BeginExecuteXmlReader中指定回呼程式,則必須呼叫這個方法。