Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DbCommand.ExecuteScalarAsync Method

.NET Framework 4.6 and 4.5

An asynchronous version of 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 ExecuteScalarAsync with CancellationToken.None.

Namespace:  System.Data.Common
Assembly:  System.Data (in System.Data.dll)

'Declaration
Public Function ExecuteScalarAsync As Task(Of Object)

Return Value

Type: System.Threading.Tasks.Task(Of Object)
A task representing the asynchronous operation.

ExceptionCondition
DbException

An error occurred while executing the command text.

For more information about asynchronous programming, see Asynchronous Programming.

.NET Framework

Supported in: 4.6, 4.5
Show:
© 2015 Microsoft