SqlCommand.EndExecuteReader(IAsyncResult) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
完成 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
返回
SqlDataReader可用于检索所请求行的对象。
例外
asyncResult 参数为 null(Microsoft Visual Basic 中的 Nothing)
EndExecuteReader(IAsyncResult) 为单个命令执行多次调用,或者方法与其执行方法不匹配(例如,调用 EndExecuteReader(IAsyncResult) 代码以完成对它的 BeginExecuteXmlReader()调用的执行)。
示例
有关演示如何使用 EndExecuteReader 该方法的示例,请参阅 BeginExecuteReader。
注解
调用 BeginExecuteReader 以执行 Transact-SQL 语句时,必须调用 EndExecuteReader才能完成该操作。 如果执行命令的过程尚未完成,此方法将阻止操作完成。 用户可以使用该方法返回BeginExecuteReader的IAsyncResult实例来验证该命令是否已完成其操作。 如果在调用 BeginExecuteReader中指定了回调过程,则必须调用此方法。