Dotnet-Project Framework documentation.

GenericDataHelper.ExecuteScalar Method (CommandType, String)

Execute a Command (that returns a 1x1 resultset and takes no parameters) against the database.

public static object ExecuteScalar(
   CommandType commandType,
   string commandText
);

Parameters

commandType
The CommandType (stored procedure, text, etc.)
commandText
The stored procedure name or T-SQL command

Return Value

An object containing the value in the 1x1 resultset generated by the command

Example

int orderCount = (int)ExecuteScalar(CommandType.StoredProcedure, "GetOrderCount");

See Also

GenericDataHelper Class | DotnetProject.Data Namespace | GenericDataHelper.ExecuteScalar Overload List