Executes the query, and returns the first column of the first row in the resultset returned by the query. Extra columns or rows are ignored.

Namespace:  Asi.iBO
Assembly:  Asi.iBO (in Asi.iBO.dll) Version: 15.1.2.0

Syntax

C#
public Object ExecuteScalar(
	CommandType commandType,
	string commandText,
	SqlParameter[] commandParameters
)
Visual Basic (Declaration)
Public Function ExecuteScalar ( _
	commandType As CommandType, _
	commandText As String, _
	commandParameters As SqlParameter() _
) As Object
Visual C++
public:
Object^ ExecuteScalar(
	CommandType commandType, 
	String^ commandText, 
	array<SqlParameter^>^ commandParameters
)

Parameters

commandType
Type: System.Data..::.CommandType
Indicates how the commandText property is interpreted.
commandText
Type: System..::.String
The SQL statement or stored procedure to execute at the data source.
commandParameters
Type: array< System.Data.SqlClient..::.SqlParameter >[]()[]
The parameters of the SQL statement or stored procedure.

Return Value

The first column of the first row in the resultset returned by the query.

Remarks

If the connection is not open prior to calling this method, the connection will be opened for the duration of the command execution and then closed.

See Also