|
strsql=strsql&") "&vOrderBy end if '------------------------------------------------------------------- set pageRs=server.CreateObject("adodb.recordset") pageRs.open strsql,conn,0,1 errMsg "記錄分頁" end function '------sql用存儲(chǔ)過程分頁------------------------------------------------------ public function sqlPage() on error resume next Set sqlPage=server.CreateObject("Adodb.RecordSet") Set Cm=Server.CreateObject("Adodb.Command") Cm.CommandType = 4 Cm.ActiveConnection = conn Cm.CommandText="sp_Util_Page" Cm.parameters(1) = vPgFields Cm.parameters(2) = vTbName Cm.parameters(3) = vConditions Cm.parameters(4) = vOrderBy Cm.parameters(5) = vPKey Cm.parameters(6) = vCurrPg Cm.parameters(7) = vPgSize Cm.parameters(8) = vRsCount() Cm.parameters(9) = "" sqlPage.CursorLocation = 3 sqlPage.LockType = 1 sqlPage.Open Cm errMsg "記錄分頁" end function '---------------------------------------------------------------------------- '關(guān)閉記錄集objRs '---------------------------------------------------------------------------- Public Function cRs(ByVal ObjRs) ObjRs.close() Set ObjRs = Nothing End Function '----------------------分頁的頁碼導(dǎo)航--------------------------------------- public function pageNav() iRsCount=vRsCount()'總記錄數(shù) mypage=vCurrPg'當(dāng)前頁數(shù) PgCount=vPgCount()'總頁數(shù) prePage=mypage-1 if prePage<1 then prePage=1 end if nextPage=mypage+1 if nextPage>PgCount then nextPage=PgCount end if pagestr="<div id=""fy""><span id=""rpc"">總共有"&iRsCount&"條記錄 "&mypage&"/"&PgCount&"</span>" pagestr=pagestr&"<a href='?currpage=1' class='aW'>首頁</a><a href='?currpage="&prePage&"' class='aW'>前一頁</a>" if (mypage-1) mod 4=0 then firstPage=mypage elseif int((mypage-1)/4)=0 then firstPage=1 else firstPage=int((mypage-1)/4)*4+1 end if endPage=firstPage+4 astr="" for i=firstPage to endPage astr=astr&"<a href='?currpage="&i&"'" if Cstr(mypage)=Cstr(i) then astr=astr&" id='currP'" end if astr=astr&">"&i&"</a>" if i>PgCount-1 then exit for next astr=astr&"<a href='?currpage="&nextPage&"' class='aW'>后一頁</a><a href='?currpage="&PgCount&"' class='aW'>尾頁</a></div>" pagestr=pagestr&astr pageNav=pagestr end function '輸出帶分頁功能的table Function showTb(ByVal TbTil) set rsTb=pageRs()'若是存儲(chǔ)過程就調(diào)用sqlPage() tbRs= rsTb.getrows() cRs(rsTb) iTblRow=Ubound(tbRs,2) iTblCol=Ubound(TbTil) tbStr="<table border='0' cellspacing='0' cellpadding='0'><tbody>" for r1=0 to iTblCol tr1=tr1&"<td width='"&split(TbTil(r1),"|")(1)&"'>"&split(TbTil(r1),"|")(0)&"</td>"本新聞共 5頁,當(dāng)前在第 4頁 1 2 3 4 5 |
|
【收藏】【打印】【進(jìn)入論壇】 |
|
|
|
|
|
|
|