ExecuteScalarAsync(CancellationToken) Method
In This Topic
This is the asynchronous version of System.Data.Common.DbCommand.ExecuteScalar. Providers should override with an appropriate implementation. The cancellation token may optionally be ignored. The default implementation invokes the synchronous System.Data.Common.DbCommand.ExecuteScalar 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 ExecuteScalar 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.
Syntax
'Declaration
Public Overloads Function ExecuteScalarAsync( _
ByVal As System.Threading.CancellationToken _
) As System.Threading.Tasks.Task(Of Object)
'Usage
Dim instance As VistaDBCommand
Dim cancellationToken As System.Threading.CancellationToken
Dim value As System.Threading.Tasks.Task(Of Object)
value = instance.ExecuteScalarAsync(cancellationToken)
public System.Threading.Tasks.Task<object> ExecuteScalarAsync(
System.Threading.CancellationToken
)
Parameters
- cancellationToken
- The token to monitor for cancellation requests.
Return Value
A task representing the asynchronous operation.
Exceptions
Exception | Description |
System.Data.Common.DbException | An error occurred while executing the command text. |
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also