System.Data.Generic
DataSourceExecuteScalarT Method (String, T) |
Executes the query, and returns the first column of the first row in the result set returned by the query.
Namespace: System.Data.Generic
Assembly: System.Data.Generic (in System.Data.Generic.dll) Version: 1.9.5473.30542 (1.9.5473.2392)

public T ExecuteScalar<T>( string SQL, T defaultValue )
Public Function ExecuteScalar(Of T) ( SQL As String, defaultValue As T ) As T
public: generic<typename T> T ExecuteScalar( String^ SQL, T defaultValue )
member ExecuteScalar : SQL : string * defaultValue : 'T -> 'T
Parameters
- SQL
- Type: SystemString
Transact-SQL statement to execute against the connection. - defaultValue
- Type: T
Default value to return in case of no return.
Type Parameters
- T
- Type to return.
Return Value
Type: TThe first column of the first row in the result set, or a null reference (Nothing in Visual Basic) if the result set is empty. Returns a maximum of 2033 characters.

