fetching records page to page top 150 records each scroll

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
KalemSayat
Posts: 4
Joined: Mon 11 Oct 2010 07:46

fetching records page to page top 150 records each scroll

Post by KalemSayat » Wed 13 Oct 2010 07:10

Hi;

i have to load datas top 150 top 150, when i scrolled data it has to load next 150 data.
And assign a memtable like MemTable.AppendData(query.Data);

Example : select top 150 * from mytable where id > 1224

next scroll

select top 150 * from mytable where id > 2395
select top 150 * from mytable where id > 3472
select top 150 * from mytable where id > 9736

something like.

Anydac has a component ADMemTable and it has a property AppendData.
They ADQuery component has Data property which you can assign datas to memtable : ADMemTable1.AppendData(ADQuery1.Data);


We saw a program and we investigate, They have fetching. when i observe sql server profiler i saw they get records top 150 top 150.

we want like this.
Is there a solition ?

AndreyZ

Post by AndreyZ » Fri 15 Oct 2010 08:08

Hello,

You can use following methods:
1. set MSQuery.FetchAll to False and MSQuery.FetchRows to 150; in this case only 150 rows will be transferred across the network at a time; in the end the whole table will be cashed in the memory of client computer.
2. set all as in the first method and additionally set MSQuery.UniDirectional to True; in this case only 150 rows will be cashed on client computer at the same time.
3. you can use the TVirtualTable and TCRBatchMove components to save data from query into the memory like this:

Code: Select all

  CRBatchMove.Source := MSQuery;
  CRBatchMove.Destination := VirtualTable;
  CRBatchMove.Execute;
For more information about listed components and options please read SDAC Reference Manual.

Post Reply