ExecuteAccountingQuery (Opnum 9)

The ExecuteAccountingQuery method executes an accounting query.

 [id(3), helpstring("method ExecuteAccountingQuery")] HRESULT ExecuteAccountingQuery(
   [in] BSTR bstrAccountingQuery,
   [in] BSTR bstrStartingDate,
   [in] BSTR bstrEndingDate,
   [out] BSTR* pbstrResult,
   [out] BOOL* pbIsThereMoreData

bstrAccountingQuery: A string that specifies an AccountingQueryCondition element (section in XML. For an example, see section 4.2.5.

bstrStartingDate: A string that specifies the starting date for the query, in date-and-time format (section If this value is not in the correct format, the date range is ignored and the complete set of accounting data is returned.

bstrEndingDate: A string that specifies the ending date for the query, in date-and-time format. If this value is not in the correct format, the date range is ignored and the complete set of accounting data is returned.

pbstrResult: A pointer to a string that returns the requested data.

This string is formatted as a set of rows representing accounting process entries. Rows are delimited by carriage return escape characters (\r). Each row is a set of columns delimited by newline escape characters (\n). The columns correspond in number and order to the columns specified in the AccountingQueryCondition element in the bstrAccountingQuery parameter.

pbIsThereMoreData: A pointer to a Boolean value that specifies whether more data is available.

Return Values: This method returns 0x00000000 for success or a negative HRESULT value (in the following table or in [MS-ERREF] section 2.1.1) if an error occurs.

Return value/code




Operation successful.



One or more arguments are invalid.



Cannot establish a connection to the accounting database.<41>



The query has been canceled. One or more of the column names specified in the accounting query are invalid.



One or more SQL SELECT columns cannot be selected because of the current SQL GROUP BY settings. These columns MUST be grouped to be selected.



One or more columns specified for SQL GROUP BY is either invalid or cannot be grouped on.



The server can service only one accounting request at a time.<42>



The query has been aborted since the management service is being shut down.

The error WRM_ERR_JET_PIVOTABLE_COLUMN_NOT_GROUPED_BY is returned in cases where a column with the IsVisible attribute set to FALSE is included in the SQL SELECT column while there are some columns in the group column collection. The following sample AccountingQueryCondition XML (section SHOULD return this error:

     <OrderColumnCollection />
     <HavingClause />

Additional IWRMAccounting interface methods are specified in section