संपादित करें

इसके माध्यम से साझा किया गया


SqlCommand.EndExecuteReader(IAsyncResult) Method

Definition

Finishes asynchronous execution of a Transact-SQL statement, returning the requested 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

Parameters

asyncResult
IAsyncResult

The IAsyncResult returned by the call to BeginExecuteReader().

Returns

A SqlDataReader object that can be used to retrieve the requested rows.

Exceptions

asyncResult parameter is null (Nothing in Microsoft Visual Basic)

EndExecuteReader(IAsyncResult) was called more than once for a single command execution, or the method was mismatched against its execution method (for example, the code called EndExecuteReader(IAsyncResult) to complete execution of a call to BeginExecuteXmlReader().

Examples

For examples demonstrating the use of the EndExecuteReader method, see BeginExecuteReader.

Remarks

When you call BeginExecuteReader to execute a Transact-SQL statement, you must call EndExecuteReader in order to complete the operation. If the process of executing the command has not yet finished, this method blocks until the operation is complete. Users can verify that the command has completed its operation by using the IAsyncResult instance returned by the BeginExecuteReader method. If a callback procedure was specified in the call to BeginExecuteReader, this method must be called.

Applies to

See also