|
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 '得到總頁數(shù) 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 '查詢數(shù)據(jù)庫 Public Function rsDB() on error resume next '簡單的查詢出結(jié)果 ' set rsDB = Server.CreateObject("ADODB.RecordSet") ' rsDB.Open strsql,conn,1,3 Set rsDB=conn.Execute(strsql) errMsg "查詢數(shù)據(jù)庫" End Function '添加,更新,刪除數(shù)據(jù)庫記錄 public Function upDB() on error resume next conn.execute(strsql) errMsg "編輯數(shù)據(jù)庫記錄" end Function '------------------------------------------------------------------------- '用來實(shí)現(xiàn)分頁的記錄集函數(shù) public function pageRs() on error resume next dim startRs startRs=(vCurrPg-1)*vPgSize '------------------------------------------------------------------------------------------- '使用此語句的話要根據(jù)參數(shù)修改代碼,具體的是若排序?yàn)閍sc則<改為>,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本新聞共 5頁,當(dāng)前在第 3頁 1 2 3 4 5 |
|
【收藏】【打印】【進(jìn)入論壇】 |
|
|
|
|
|
|
|