|
rsc.open sqlc,conn,0,1 RsNum=rsc("IdCount") rsc.close set rsc=nothing if RsNum>0 then response.Cookies("iRecord")=RsNum vRsCount=RsNum else vRsCount=0 end if else vRsCount=request.Cookies("iRecord") end if end property '得到总页数 public property get vPgCount() iRsCount2=vRsCount() if iRsCount2 mod vPgSize =0 then vPgCount=int(iRsCount2/vPgSize) else vPgCount=int(iRsCount2/vPgSize)+1 end if end property '查询数据库 Public Function rsDB() on error resume next '简单的查询出结果 ' set rsDB = Server.CreateObject("ADODB.RecordSet") ' rsDB.Open strsql,conn,1,3 Set rsDB=conn.Execute(strsql) errMsg "查询数据库" End Function '添加,更新,删除数据库记录 public Function upDB() on error resume next conn.execute(strsql) errMsg "编辑数据库记录" end Function '------------------------------------------------------------------------- '用来实现分页的记录集函数 public function pageRs() on error resume next dim startRs startRs=(vCurrPg-1)*vPgSize '------------------------------------------------------------------------------------------- '使用此语句的话要根据参数修改代码,具体的是若排序为asc则<改为>,min改为max ' if startRs=0 then ' strsql="select top "&vPgSize&" "&vPgFields&" from "&vTbName&" "&vConditions&" "&vOrderBy ' else ' strsql="select top "&vPgSize&" "&vPgFields&" from "&vTbName&" "&vConditions&" and "&vPKey&" < " ' strsql=strsql&"(select min("&vPKey&") from (select top "&startRs&" "&vPKey&" from " ' strsql=strsql&vTbName&" "&vConditions&" "&vOrderBy&") as idTable) "&vOrderBy ' end if '--------------------------------------------------------------- if startRs=0 then strsql="select top "&vPgSize&" "&vPgFields&" from "&vTbName&" "&vConditions&" "&vOrderBy else strsql="select top "&vPgSize&" "&vPgFields&" from "&vTbName&" "&vConditions&" and "&vPKey&" not " strsql=strsql&"in (select top "&startRs&" "&vPKey&" from "&vTbName&" "&vConditions&" "&vOrderBy |
|
【收藏】【打印】【进入论坛】 |
|
|
|
|
|
|
|