Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
SqlCommand Class
 EndExecuteNonQuery Method

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
SqlCommand..::.EndExecuteNonQuery Method

Finishes asynchronous execution of a Transact-SQL statement.

Namespace:  System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)
Visual Basic (Declaration)
Public Function EndExecuteNonQuery ( _
    asyncResult As IAsyncResult _
) As Integer
Visual Basic (Usage)
Dim instance As SqlCommand
Dim asyncResult As IAsyncResult
Dim returnValue As Integer

returnValue = instance.EndExecuteNonQuery(asyncResult)
C#
public int EndExecuteNonQuery(
    IAsyncResult asyncResult
)
Visual C++
public:
int EndExecuteNonQuery(
    IAsyncResult^ asyncResult
)
JScript
public function EndExecuteNonQuery(
    asyncResult : IAsyncResult
) : int

Parameters

asyncResult
Type: System..::.IAsyncResult
The IAsyncResult returned by the call to BeginExecuteNonQuery.

Return Value

Type: System..::.Int32
The number of rows affected (the same behavior as ExecuteNonQuery).
ExceptionCondition
ArgumentException

asyncResult parameter is null (Nothing in Microsoft Visual Basic)

InvalidOperationException

EndExecuteNonQuery 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 to complete execution of a call to BeginExecuteXmlReader.

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.

For examples demonstrating the use of the EndExecuteNonQuery method, see BeginExecuteNonQuery.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker