Share via


SqlCommand.EndExecuteXmlReader(IAsyncResult) 方法

定義

完成 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參數在 Microsoft Visual Basic) 中為 null ( Nothing

EndExecuteXmlReader(IAsyncResult) 針對單一命令執行呼叫一次以上,或方法與其執行方法不符 (,例如,呼叫 EndExecuteXmlReader(IAsyncResult) 以完成呼叫 BeginExecuteNonQuery() 的程式碼。

範例

如需示範如何使用 方法的 EndExecuteXmlReader 範例,請參閱 BeginExecuteXmlReader

備註

當您呼叫 BeginExecuteXmlReader 以執行 Transact-SQL 語句時,必須呼叫 EndExecuteXmlReader 才能完成作業。 如果執行命令的程式尚未完成,這個方法會封鎖直到作業完成為止。 使用者可以使用 方法傳回的 BeginExecuteXmlReader 實例,確認命令已完成其作業 IAsyncResult 。 如果在 呼叫 BeginExecuteXmlReader 中指定回呼程式,則必須呼叫這個方法。

適用於