Options.QueryRecCount and select top

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
colutti
Posts: 6
Joined: Wed 08 Jun 2011 21:06

Options.QueryRecCount and select top

Post by colutti » Wed 08 Jun 2011 21:49

Hello

I have set:

oMSStoredProc.FetchAll := False;
oMSStoredProc.Options.QueryRecCount := True;

And I have tried to execute a simple query as follow:

select top 100 * from mytable

And the oMSStoredProc.RecordCount property returned more than 100 lines. I think it is a bug.

AndreyZ

Post by AndreyZ » Thu 09 Jun 2011 12:55

Hello,

The point is that the QueryRecCount property isn't used for stored procedures. Therefore the TMSStoredProc.RecordCount property shows the number of records that were fetched from the server. In any case it cannot be more than the record count of the result dataset.

colutti
Posts: 6
Joined: Wed 08 Jun 2011 21:06

Post by colutti » Thu 09 Jun 2011 13:02

I am not executing stored procedures, and the same thing happens with TMSQuery.

AndreyZ

Post by AndreyZ » Fri 10 Jun 2011 09:48

For the time being SDAC doesn't take into account the TOP statement in a query for counting records number. We will investigate the possibility of changing such behaviour.

Post Reply