该ASP通用分页类主要是易用, 速度取决于实际应用: 若已指定记录总数(intRecordCount 属性), 可支持 百万级 数据应用;若指定了统计语句(strSqlCount 属性), 则取决于该语句的统计效率; 若两者皆未指定, 则根据用户给定的查询语句, 取RecordCount属性值, 当然这样的效率就不会高了. 若您在应用中遇到问题, 请使用MSN与我联系: xiaoyuehen(at)msn.com
适用范围:
1. 用于一般分页需求, 只需指定查询语句及其他几个主要参数即可, 方便易用.
2.分页的速度取决于你给的 SQL 语句执行效率.
3.可指定记录数统计语句, 也可以自己设置记录集总数, 灵活定制.
4.若不喜欢类产生的分页导航, 也可自行设定转向.
示例:
CustomPageView.asp (名称可任取) <link href="D:/htmlcode/style/aspvbs.css" type="text/css" rel="stylesheet">
%@LANGUAGE % % % !--#include file-- % True intDateStart intDateStart f__OpenConn strDbPath connstr strDbPath connstr connstr connstr strDbPath conn conn connstr f__CloseConn conn conn conn nothing getTimeOveriflag tTimeOver iflag tTimeOver intDateStart true getTimeOver tTimeOver tTimeOver intDateStart true getTimeOver tTimeOver strLocalUrl strLocalUrl intPageNow intPageNow intPageSize strPageInfo intPageSize arrRecordInfo i Conn sql sqlCount sql _ _ sqlCount _ f__OpenConn clsRecordInfo clsRecordInfo New Cls_PageView clsRecordInfointRecordCount clsRecordInfostrSqlCount sqlCount clsRecordInfostrSql sql clsRecordInfointPageSize intPageSize clsRecordInfointPageNow intPageNow clsRecordInfostrPageUrl strLocalUrl clsRecordInfostrPageVar clsRecordInfoobjConn Conn arrRecordInfo clsRecordInfoarrRecordInfo strPageInfo clsRecordInfostrPageInfo clsRecordInfo nothing f__CloseConn % html head meta http-equiv content title分页测试/title style type !-- PageView { font-size ; } PageView td { border-right-style solid; border-bottom-style solid; border-right-color #E0E0E0; border-bottom-color #E0E0E0; border-right-width ; border-bottom-width ; } PageView table { border-left-style solid; border-top-style solid; border-left-color #E0E0E0; border-top-color #E0E0E0; border-top-width ; border-left-width ; } trHeader { background #EFF7FF; font-size ; font-weight bold; line-height %; text-align center; } -- /style style type !-- body { font-size ; } alink { color #993300; text-decoration none; } avisited { color #003366; text-decoration none; } ahover { color #0066CC; text-decoration underline; } aactive { color #000000; text-decoration none; } table { font-size ; } -- /style /head body table width border cellspacing cellpadding tr tdnbsp;% strPageInfo%/td /tr /table div table width border cellspacing cellpadding tr td进仓ID/td td产品ID/td td进仓数量/td /tr % arrRecordInfo i to arrRecordInfo % tr tdnbsp;% arrRecordInfo i%/td tdnbsp;% arrRecordInfo i%/td tdnbsp;% arrRecordInfo i%/td /tr % % /table /div table width border cellspacing cellpadding tr tdnbsp;% strPageInfo%/td /tr /table table width border cellspacing cellpadding tr td alignnbsp;% getTimeOver%/td /tr /table /body /html
类文件:
Cls_PageView.asp
<link href="d:/htmlcode/style/aspvbs.css" type="text/css" rel="stylesheet">
% Cls_PageView sbooInitState sstrPageUrl sstrPageVar sstrSql sstrSqlCount sintRecordCount sintPageSize sintPageNow sintPageMax sobjConn sstrPageInfo Class_Initialize ClearVars class_terminate sobjConn nothing ClearVars sbooInitState False sstrPageUrl sstrPageVar sintRecordCount sintPageSize sintPageNow sintPageMax ClearMainVars sstrSql strSQL sstrSql strSQLCount sstrSqlCount strPageUrl sstrPageUrl intPageSize sintPageSize toNum objConn sobjConn intPageNow sintPageNow toNum intRecordCount sintRecordCount toNum -1 sintRecordCount sintRecordCount -1 strPageVar sstrPageVar intPageNow intPageNow singPageNow strPageInfo strPageInfo sstrPageInfo arrRecordInfo InitClass sbooInitState rs sql sql sstrSql rs sstrSqlCount rs sstrSqlCount sobjConn rseof rsbof sintRecordCount rs sintRecordCount rs rs sql sobjConn sintRecordCount sintRecordCount rsRecordCount sintRecordCount sintRecordCount InitPageInfo rseof rsbof rsPageSize sintPageSize rsAbsolutePage sintPageNow rseof rsbof arrRecordInfo rsgetrowssintPageSize arrRecordInfo arrRecordInfo rs rs nothing ClearMainVars InitPageInfo sstrPageInfo surl surl sstrPageUrl surl surl surl sstrPageVar surl surl sstrPageVar sintPageNow sintPageNow sintRecordCount sintPageSize sintPageMax sintRecordCount sintPageSize sintPageMax sintRecordCount sintPageSize sintPageNow sintPageMax sintPageNow sintPageMax sintPageNow sstrPageInfo sstrPageInfo sstrPageInfo surl sstrPageInfo sstrPageInfo surl sintPageNow sintPageMax sintPageNow sstrPageInfo sstrPageInfo sstrPageInfo sstrPageInfo surl sintPageNow sstrPageInfo sstrPageInfo surl sintPageMax sstrPageInfo sstrPageInfo sintPageNow sintPageMax sstrPageInfo sstrPageInfo sintRecordCount sintPageSize toNums Default s s s s toNum s toNum Default InitClass sbooInitState True sobjConn sbooInitState False sstrSql sbooInitState False sintPageSize toNumsintPageSize sintPageSize sintPageSize sbooInitState False sintPageNow toNumsintPageNow sintRecordCount -1 %