|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Access是一种桌面数据库,只适合数据量少的应用,在处理少量数据和单机访问的数据库时是很好的,效率也很高。但是它的同时访问客户端不能多于4个。access数据库有一定的极限,如果数据达到100M左右,很容易造成服务器iis假死,或者消耗掉服务器的内存导致服务器崩溃。分页<%+++++++++++++++++++++++++++++++++++++++++++++++++++++++
挪用例子
Dimint_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
int_RPP=2设置每页显现数量
int_showNumberLink_=8数字导航显现数量
showMorePageGo_Type_=1是下拉菜单仍是输出值跳转,当屡次挪用时只能选1
str_nonLinkColor_="#999999"非热链接色彩
toF_="<fontface=webdings>9</font>"首页
toP10_="<fontface=webdings>7</font>"上十
toP1_="<fontface=webdings>3</font>"上一
toN1_="<fontface=webdings>4</font>"下一
toN10_="<fontface=webdings>8</font>"下十
toL_="<fontface=webdings>:</font>"尾页
============================================
这段代码必定要在VClass_Rs.Open与for轮回之间
SetVClass_Rs=CreateObject(G_FS_RS)
VClass_Rs.OpenThis_Fun_Sql,User_Conn,1,1
IFnotVClass_Rs.eofTHEN
VClass_Rs.PageSize=int_RPP
cPageNo=NoSqlHack(Request.QueryString("Page"))
IfcPageNo=""ThencPageNo=1
Ifnotisnumeric(cPageNo)ThencPageNo=1
cPageNo=Clng(cPageNo)
IfcPageNo<=0ThencPageNo=1
IfcPageNo>VClass_Rs.PageCountThencPageNo=VClass_Rs.PageCount
VClass_Rs.AbsolutePage=cPageNo
FORint_Start=1TOint_RPP
++++++++++
加轮回体显现数据
++++++++++
VClass_Rs.MoveNext
ifVClass_Rs.eoforVClass_Rs.bofthenexitfor
NEXT
ENDIF
============================================
response.Write"<p>"&fPageCount(VClass_Rs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*********************************************************
目标:分页的页面参数坚持
提交查询的分歧性
输出:moveParam:分页参数
removeList:要移除的参数
前往:分页Url
*********************************************************
FunctionPageUrl(moveParam,removeList)
dimstrName
dimKeepUrl,KeepForm,KeepMove
removeList=removeList&","&moveParam
KeepForm=""
ForEachstrNameinRequest.Form
判别form参数中的submit、空值
ifnotInstrRev(","&removeList&",",","&strName&",",-1,1)>0andRequest.Form(strName)""then
KeepForm=KeepForm&"&"&strName&"="&Server.URLencode(Request.Form(strName))
endif
removeList=removeList&","&strName
Next
KeepUrl=""
ForEachstrNameInRequest.QueryString
Ifnot(InstrRev(","&removeList&",",","&strName&",",-1,1)>0)Then
KeepUrl=KeepUrl&"&"&strName&"="&Server.URLencode(Request.QueryString(strName))
EndIf
Next
KeepMove=KeepForm&KeepUrl
If(KeepMove"")Then
KeepMove=Right(KeepMove,Len(KeepMove)-1)
KeepMove=Server.HTMLEncode(KeepMove)&"&"
EndIf
PageUrl=replace(Request.ServerVariables("URL"),"/Search.asp","/Search.html")&"?"&KeepMove&moveParam&"="
PageUrl="?"&KeepMove&moveParam&"="
EndFunction
FunctionfPageCount(Page_Rs,showNumberLink_,nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,Page)
DimThis_Func_Get_Html_,toPage_,p_,sp2_,I,tpagecount
DimNaviLength,StartPage,EndPage
This_Func_Get_Html_="":I=1
NaviLength=showNumberLink_
ifIsEmpty(showMorePageGo_Type_)thenshowMorePageGo_Type_=1
tpagecount=Page_Rs.pagecount
IftPageCount<1ThentPageCount=1
ifnotPage_Rs.eofornotPage_Rs.bofthen
toPage_=PageUrl("Page","submit,GetType,no-cache,_")
ifPage=1then
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""首页"">"&toF_&"</font>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&"1title=""首页"">"&toF_&"</a>"&vbNewLine
EndIf
ifPage<NaviLengththen
StartPage=1
else
StartPage=fix(Page/NaviLength)*NaviLength
endif
EndPage=StartPage+NaviLength-1
IfEndPage>tPageCountThenEndPage=tPageCount
IfStartPage>1Then
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&Page-NaviLength&"title=""上"&int_showNumberLink_&"页"">"&toP10_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""上"&int_showNumberLink_&"页"">"&toP10_&"</font>"&vbNewLine
EndIf
IfPage1andPage0Then
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&(Page-1)&"title=""上一页"">"&toP1_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""上一页"">"&toP1_&"</font>"&vbNewLine
EndIf
ForI=StartPageToEndPage
IfI=PageThen
This_Func_Get_Html_=This_Func_Get_Html_&"<b>"&I&"</b>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&I&">"&I&"</a>"&vbNewLine
EndIf
IfItPageCountThenThis_Func_Get_Html_=This_Func_Get_Html_&vbNewLine
Next
IfPagePage_Rs.PageCountandPage0Then
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&(Page+1)&"title=""下一页"">"&toN1_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""下一页"">"&toN1_&"</font>"&vbNewLine
EndIf
IfEndPage<tpagecountThen
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&Page+NaviLength&"title=""下"&int_showNumberLink_&"页"">"&toN10_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""下"&int_showNumberLink_&"页"">"&toN10_&"</font>"&vbNewLine
EndIf
ifPage_Rs.PageCountPagethen
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&Page_Rs.PageCount&"title=""尾页"">"&toL_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""尾页"">"&toL_&"</font>"&vbNewLine
EndIf
IfshowMorePageGo_Type_=1then
DimShow_Page_i
Show_Page_i=Page+1
ifShow_Page_i>tPageCountthenShow_Page_i=1
This_Func_Get_Html_=This_Func_Get_Html_&"<inputtype=""text""size=""4""maxlength=""10""name=""Func_Input_Page""this.focus();""this.value="&Show_Page_i&";""onKeyUp=""value=value.replace(/[^1-9]/g,)""onbeforepaste=""clipboardData.setData(text,clipboardData.getData(text).replace(/[^1-9]/g,))"">"&vbNewLine_
&"<inputtype=""button""value=""Go""Func_Input_Page.focus();""javascript:varJs_JumpValue;Js_JumpValue=document.all.Func_Input_Page.value;if(Js_JumpValue==||!isNaN(Js_JumpValue))location="&topage_&"+Js_JumpValue;elselocation="&topage_&"1;"">"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"跳转:<selectNAME=menu1onChange=""varJs_JumpValue;Js_JumpValue=this.options[this.selectedIndex].value;if(Js_JumpValue!=)location=Js_JumpValue;"">"
fori=1totPageCount
This_Func_Get_Html_=This_Func_Get_Html_&"<optionvalue="&topage_&i
ifPage=ithenThis_Func_Get_Html_=This_Func_Get_Html_&"selectedstyle=color:#0000FF"
This_Func_Get_Html_=This_Func_Get_Html_&">第"&cstr(i)&"页</option>"&vbNewLine
next
This_Func_Get_Html_=This_Func_Get_Html_&"</select>"&vbNewLine
Endif
This_Func_Get_Html_=This_Func_Get_Html_&p_&sp2_&"每页<b>"&Page_Rs.PageSize&"</b>个纪录,如今是:<b><spanclass=""tx"">"&sp2_&Page&"</span>/"&tPageCount&"</b>页,共<b><spanid=recordcount>"&sp2_&Page_Rs.recordCount&"</span></b>个纪录。"
else
没有纪录
endif
fPageCount=This_Func_Get_Html_
EndFunction
%>
asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。 |
|