I'm facing an issue using COM API.I'm trying to return entire table count from a couple of Tables say Person,Opportunity,etc.
My code is as follows.
var Query = CRM.CreateQueryObj("select count(*) as VALUE from person"); Query.SelectSQL(); var count= Query ("VALUE");
returns me a wrong count
I also tried using RecordCount(TCL below is the database name)
var Query = CRM.CreateQueryObj("select * from company ", "TCL"); Query.SelectSQL(); var sageCount = Query.RecordCount;
still returns me the same wrong count.
The row count does not match the actual count.Any suggestions anyone?
Have you looked in the SQL log to see the SQL that is actually passed to the database? Both of these methods will be recorded in the standard SQL log andthis will allow you to see whether additional clauses are being added to the SQL.
yes i used profiler logs to find the query being fired.It was the same,no additional where clause.I tried adding the where clause in the code, profiler logs shows same correct query,but again count different.
Hmm,Still stuck on this one.
© The Sage Group plc 2019All Rights Reserved