Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Finishes asynchronous execution of a Transact-SQL statement.
public:
int EndExecuteNonQuery(IAsyncResult ^ asyncResult);
public int EndExecuteNonQuery(IAsyncResult asyncResult);
member this.EndExecuteNonQuery : IAsyncResult -> int
Public Function EndExecuteNonQuery (asyncResult As IAsyncResult) As Integer
The IAsyncResult returned by the call to BeginExecuteNonQuery().
The number of rows affected (the same behavior as ExecuteNonQuery()).
asyncResult
parameter is null (Nothing
in Microsoft Visual Basic)
EndExecuteNonQuery(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 EndExecuteNonQuery(IAsyncResult) to complete execution of a call to BeginExecuteXmlReader().
The amount of time specified in CommandTimeout elapsed and the asynchronous operation specified with BeginExecuteNonQuery is not complete.
-or-
In some situations, IAsyncResult can be set to IsCompleted
incorrectly. If this occurs and EndExecuteNonQuery(IAsyncResult) is called, EndExecuteNonQuery could raise a SqlException error if the amount of time specified in CommandTimeout elapsed and the asynchronous operation specified with BeginExecuteNonQuery is not complete. To correct this situation, you should either increase the value of CommandTimeout or reduce the work being done by the asynchronous operation.
For examples demonstrating the use of the EndExecuteNonQuery method, see BeginExecuteNonQuery.
When you call BeginExecuteNonQuery to execute a Transact-SQL statement, you must call EndExecuteNonQuery 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 BeginExecuteNonQuery method. If a callback procedure was specified in the call to BeginExecuteNonQuery, this method must be called.
Product | Versions |
---|---|
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in