Dotnet-Project Framework documentation.

GenericDataHelper.ExecuteScalar Method (String, IDataParameter[])

Execute a stored procedure via a Command (that returns a 1x1 resultset) against the database using the provided parameters.

public static object ExecuteScalar(
   string spName,
   params IDataParameter[] commandParameters
);

Parameters

spName
The stored procedure name
commandParameters
An array of Parameters used to execute the command

Return Value

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

Example

int orderCount = (int)ExecuteScalar("GetOrderCount", new SqlParameter("@prodid", 24));

See Also

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