DataSource.ExecuteScalar(T) Method (String)

System.Data.Generic

DataSourceExecuteScalarT Method (String)
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)
Syntax
public T ExecuteScalar<T>(
	string SQL
)
Public Function ExecuteScalar(Of T) ( 
	SQL As String
) As T
public:
generic<typename T>
T ExecuteScalar(
	String^ SQL
)
member ExecuteScalar : 
        SQL : string -> 'T 

Parameters

SQL
Type: SystemString
Transact-SQL statement to execute against the connection.

Type Parameters

T
Type to return.

Return Value

Type: T
The 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.
Remarks