Skip to content

SqlHelper.ExecuteScalarAsync method (1 of 2)

Executes the statement asynchronously returning a scalar value.

public static Task<object> ExecuteScalarAsync(IDbConnection connection, SqlQuery query, 
    ILogger logger = null, CancellationToken cancellationToken = default)
parameter description
connection The connection.
query The select query.
logger The logger.
cancellationToken The cancellation token.

Return Value

A task that represents the asynchronous operation. The task result contains the scalar value.

Exceptions

exception condition
ArgumentNullException selectQuery is null.

See Also


SqlHelper.ExecuteScalarAsync method (2 of 2)

Executes the statement asynchronously returning a scalar value.

public static Task<object> ExecuteScalarAsync(IDbConnection connection, string commandText, 
    IDictionary<string, object> param = null, ILogger logger = null, 
    CancellationToken cancellationToken = default)
parameter description
connection The connection.
commandText The command text.
param The parameters.
logger The logger.
cancellationToken The cancellation token.

Return Value

A task that represents the asynchronous operation. The task result contains the scalar value.

Exceptions

exception condition
ArgumentNullException connection is null.

See Also