ExecuteScalarAsync Method
In This Topic
An asynchronous version of System.Data.Common.DbCommand.ExecuteScalar, which executes the query and returns the first column of the first row in the result set returned by the query. All other columns and rows are ignored. Invokes System.Data.Common.DbCommand.ExecuteScalarAsync(System.Threading.CancellationToken) with CancellationToken.None.
Overload List
Overload | Description |
ExecuteScalarAsync() | An asynchronous version of System.Data.Common.DbCommand.ExecuteScalar, which executes the query and returns the first column of the first row in the result set returned by the query. All other columns and rows are ignored. Invokes System.Data.Common.DbCommand.ExecuteScalarAsync(System.Threading.CancellationToken) with CancellationToken.None. (Inherited from System.Data.Common.DbCommand) |
ExecuteScalarAsync(CancellationToken) | 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. (Inherited from System.Data.Common.DbCommand) |
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