你可以利用ClientDataSet的PackRecords 的属性,
将ADOQUERY连到DataSetProvider,将ClientDataSet也指向DataSetProvider,
设置ClientDataSet的PackRecords属性

ClientDataSet.FetchOnDemand := false;
ClientDataSet.PackRecords := 10;
不过这时ClientDataSet取一下包时要写语句。
ClientDataSet.GetNextPacket

解决方案 »

  1.   

    呵呵,就这样写啊
    select * from MyTable fetch first 10 rows only
      

  2.   

    select * from MyTable fetch first 10 rows only fatch和这里的first何解?
      

  3.   

    fatch和first意为提取表里的前十条记录.
      

  4.   

    如果我来做,我想我会让delphi去调用存储过程,让存储过程把分好页的数据发给我就好了。我在delphi中只要将要第几页,每页几条记录告诉存储过程就好了。在存储过程中分页就比较好办了,至少我已经解决:)
      

  5.   

    这样设置:
    adodataset.recordset.pagesize:=10;相关属性:
    adodataset.recordset.pagecount; 
    adodataset.recordset.absolutepage;  
      

  6.   

    to wintle(文子) 
    你好,能不能说一下你的做法
      

  7.   

    delphi调用就不说了。应该都会吧。至于那个存储过程,我是这样做的,你们可以参考一下:
    以下是我的一个系统中的源代码,共享一下了:)--------------
    CREATE PROCEDURE dbo.log_login_get
    @page int,
    @page_size int
     AS
     declare @intBeginID int
     declare @intEndID int
     declare @intMaxCount int
     declare @intPageCount int
     declare @intRowCount int
     declare @intMaxPage int
     set nocount on
     select @intMaxCount=count(*) from log_login
     if(@intMaxCount=0)
     return 0
     set @intMaxPage=Round((@intMaxCount/@page_size),0)
     if(@page-1>@intMaxPage)
     select @page=@intMaxPage+1
     if(@page<1)
     select @page=1
     set @intRowCount=(@page-1)*@page_size+1
    --print @intRowCount
     set rowcount @intRowCount
     select @intBeginId=id from log_login order by id desc
    --print @intBeginId
     select @intRowCount=@page*@page_size
     --print @intRowCount
     set rowcount @intRowCount
     select @intEndId=id from log_login order by id desc
    --print @intEndId
     set rowcount 0
     set nocount off
     select * from log_login where id between  @intEndId and @intBeginId order by id desc
    GO
    -------------
    我也是借鉴了别人的做法才写出来的。