• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

Access的分页代码

开发技术 开发技术 7小时前 5次浏览
    if giPage = 1 then begin
        sSQL    := 'SELECT TOP 10 * FROM dw_demo WHERE '+sWhere +' ORDER BY '+sOrder+' DESC';
    end else begin
        sSQL    := 'SELECT TOP 10 * FROM dw_demo WHERE id NOT IN ('
                        +'SELECT TOP '+(giPage*10-10).ToString+' id FROM dw_demo '
                        +'WHERE '+sWhere+' ORDER BY '+SOrder +' DESC'
                   +') AND '+sWhere +' ORDER BY '+sOrder +' DESC';
        sSQL    :=
            'select top 10 * from dw_demo where id not in (select top '+(giPage*10-10).ToString+' id '
            +'from dw_demo order by '+sOrder+' desc) order by '+sOrder+' desc ';
    end;

保存一下Access的分页代码。 实在有点折磨人!

    //得到排序
    case giSort of
        0 : begin   //view
            sOrder  := '[view],id';
        end;
        1 : begin   //时间
            sOrder  := 'createtime,id';
        end;
        2 : begin   //star
            sOrder  := 'star,id';
        end;
        3 : begin   //download
            sOrder  := 'download,id';
        end;
        4 : begin   //buy
            sOrder  := 'buy,id';
        end;
    end;

 


程序员灯塔
转载请注明原文链接:Access的分页代码
喜欢 (0)