使用英语阅读

通过


SqlCommand.EndExecuteXmlReader(IAsyncResult) 方法

定义

完成 Transact-SQL 语句的异步执行,从而将请求的数据以 XML 形式返回。

public System.Xml.XmlReader EndExecuteXmlReader(IAsyncResult asyncResult);

参数

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中指定了回调过程,则必须调用此方法。

适用于

产品 版本
.NET 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

另请参阅