When executed with ExecuteScalar(), the (first row) of the Result Set of the Stored Procedure should be returned. Instead, it returned the output parameter, which cannot be cast to (int). This was because, when the statement type was SQL_CALL, the ExecuteScalar() function was not called. The logic has been modified to correct this.