现在从数据库中查询出1000条数据,我想分页显示到MSHFlexGrid中,但不知道怎么实现,请知道的高手指导一下,谢谢。

解决方案 »

  1.   

    1.定义一个记录集对象(模块级)
    2.利用记录集的PageSize和PageCount属性
       RsPrint.PageSize = MSHFlexGrid1.Rows - 1 '有一行是表头
    3.循环加载数据
      For i = 1 To vMSFG.Rows - 1
         '……
         Rs.movenext
      next
      

  2.   

    用vsf。
    不要显示的rowhidden = true,
    下面加两个按钮,<, >.
    按钮里加代码 调整 要显示的行。
      

  3.   

    在sql语句中用top分页,MSHFlexGrid中的首行就是最小值,最后一行就是最大值,这样速度很快的:
    比如首页:
    select top 30 * from tb order by id
    下一页:
    select top 30 * from tb where id > 当前最大ID order by id
    上一页:
    select top 30 * from tb where id < 当前最小ID order by id
    末页:
    select * from (select top 30 * from tb order by id desc) order by id
      

  4.   

    改一下:上一页: 
    select * 
    from (select top 30 * from tb where id < 当前最小ID order by id desc)
    order by id都是随手写的,语法不一定正确,只是一个思路,参考一下吧...
      

  5.   

    不用存储过程,用rs.PageSize
              currentpage = currentpage + 1
              currentpage = currentpage
              rs.AbsolutePage = currentpage
      

  6.   


    这种在后台是一次性读取全部数据的,效率低!
    正确的做法应该使用诸如MySQL的SQL语句:“select * FROM 表名 limit 0,50”进行物理分页!!