Gemstone Data Library
Show/Hide TOC

# AdoDataConnectionExecuteScalarAsync T(T, String, CancellationToken, Object) Method

Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type T, substituting defaultValue if Value is retrieved.

## Definition

Namespace: Gemstone.Data
Assembly: Gemstone.Data (in Gemstone.Data.dll) Version: 1.0.160 -- Release Build+0b65775365098d82320afec1fcaed7affaca67e3
C#
View Source Request Example

    public Task<T> ExecuteScalarAsync<T>(
    	T defaultValue,
    	string sqlFormat,
    	CancellationToken cancellationToken,
    	params Object?[] parameters
    )

VB
View Source Request Example

    Public Function ExecuteScalarAsync(Of T) (
    	defaultValue As T,
    	sqlFormat As String,
    	cancellationToken As CancellationToken,
    	ParamArray parameters As Object()
    ) As Task(Of T)

C++
View Source Request Example

    public:
    generic<typename T>
    Task<T>^ ExecuteScalarAsync(
    	T defaultValue,
    	String^ sqlFormat,
    	CancellationToken cancellationToken,
    	... array<Object^>^ parameters
    )

JavaScript
View Source Request Example

    JavaScript does not support generic types or methods.

#### Parameters

defaultValue T
  The value to be substituted if Value is retrieved.
sqlFormat String
  Format string for the SQL statement to be executed.
cancellationToken CancellationToken
  Propagates notification that operations should be canceled.
parameters Object
  The parameter values to be used to fill in DbParameter parameters.

#### Type Parameters

T

  [Missing <typeparam name="T"/> documentation for "M:Gemstone.Data.AdoDataConnection.ExecuteScalarAsync``1(``0,System.String,System.Threading.CancellationToken,System.Object[])"]

#### Return Value

Task T
Value in the first column of the first row in the result set.

## See Also

#### Reference

AdoDataConnection Class
ExecuteScalarAsync Overload
Gemstone.Data Namespace