DbCommand.ExecuteNonQueryAsync DbCommand.ExecuteNonQueryAsync DbCommand.ExecuteNonQueryAsync DbCommand.ExecuteNonQueryAsync Method

Definition

This method implements the asynchronous version of ExecuteNonQuery(), but returns a Task synchronously, blocking the calling thread.

Overloads

ExecuteNonQueryAsync(CancellationToken) ExecuteNonQueryAsync(CancellationToken) ExecuteNonQueryAsync(CancellationToken)

This is the asynchronous version of ExecuteNonQuery(). Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.

The default implementation invokes the synchronous ExecuteNonQuery() method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteNonQuery() will be communicated via the returned Task Exception property.

Do not invoke other methods and properties of the DbCommand object until the returned Task is complete.

ExecuteNonQueryAsync() ExecuteNonQueryAsync() ExecuteNonQueryAsync() ExecuteNonQueryAsync()

An asynchronous version of ExecuteNonQuery(), which executes a SQL statement against a connection object.

Invokes ExecuteNonQueryAsync(CancellationToken) with CancellationToken.None.

Remarks

For more information about asynchronous programming, see Asynchronous Programming.

ExecuteNonQueryAsync(CancellationToken) ExecuteNonQueryAsync(CancellationToken) ExecuteNonQueryAsync(CancellationToken)

This is the asynchronous version of ExecuteNonQuery(). Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.

The default implementation invokes the synchronous ExecuteNonQuery() method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteNonQuery() will be communicated via the returned Task Exception property.

Do not invoke other methods and properties of the DbCommand object until the returned Task is complete.

public:
 virtual System::Threading::Tasks::Task<int> ^ ExecuteNonQueryAsync(System::Threading::CancellationToken cancellationToken);
public virtual System.Threading.Tasks.Task<int> ExecuteNonQueryAsync (System.Threading.CancellationToken cancellationToken);
abstract member ExecuteNonQueryAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
override this.ExecuteNonQueryAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
Parameters
cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

A task representing the asynchronous operation.

Exceptions

An error occurred while executing the command text.

Remarks

For more information about asynchronous programming, see Asynchronous Programming.

ExecuteNonQueryAsync() ExecuteNonQueryAsync() ExecuteNonQueryAsync() ExecuteNonQueryAsync()

An asynchronous version of ExecuteNonQuery(), which executes a SQL statement against a connection object.

Invokes ExecuteNonQueryAsync(CancellationToken) with CancellationToken.None.

public:
 System::Threading::Tasks::Task<int> ^ ExecuteNonQueryAsync();
public System.Threading.Tasks.Task<int> ExecuteNonQueryAsync ();
member this.ExecuteNonQueryAsync : unit -> System.Threading.Tasks.Task<int>
Public Function ExecuteNonQueryAsync () As Task(Of Integer)
Returns

A task representing the asynchronous operation.

Exceptions

An error occurred while executing the command text.

Remarks

For more information about asynchronous programming, see Asynchronous Programming.

Applies to