|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
SQLServer是基于服务器端的中型的数据库,可以适合大容量数据的应用,在功能上管理上也要比Access要强得多。在处理海量数据的效率,后台开发的灵活性,可扩展性等方面强大。分页效果:
首页上十上一11121314151617181920下一下十尾页转到___
11/20页963篇
主文件:dateview.asp,查询参数yearview=,分页参数pageview=
包括文件:abbr.asp
dateview.asp?yearview=2004&pageivew=1
---/-------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT"CODEPAGE="65001"%>
<!--#includefile="include/abbr.asp"-->
<scriptlanguage="JavaScript"type="text/JavaScript">
<!--//页面跳转剧本
functionMM_jumpMenu(targ,selObj,restore){//v3.0
eval(targ+".location="+selObj.options[selObj.selectedIndex].value+"");
if(restore)selObj.selectedIndex=0;
}
//-->
</script>
<%查询年份分页dateview.asp?yearview=2004&pageivew=1
subject:ASP分页操纵,改进版byStabx
author:Stabx<shawl.qiu@gmail.com>
blog:http://blog.csdn.net/btbtdhttp://btbtd.exblog.jp/
blogname:Phoenix.GI-P.GI
date:2006-4-21
rsn.PageCount/总页数
pageview/以后页数
DimI界说轮回变量
DimRPPRPP:指定每页显现的纪录数,
Dimpageview翻页变量
I=1从1入手下手
RPP=50每页显现50笔记录
pageview=CInt(Request("pageview"))读取URL页号
Dimrsn界说链接名
Setrsn=Server.CreateObject("ADODB.Recordset")创建一个rsn数据库查询
rsn.ActiveConnection=MM_conn_STRINGrsn链接体例,这是DW的链接字符串
rsn.Source="selectarticle.*,class.*,nclass.*fromarticle,class,nclasswherearticle.classid=class.classidandarticle.nclassid=nclass.nclassidandyear(dateandtime)="&request.QueryString("yearview")&"orderbydateandtimeasc"
rsn查询语句,SELECT一切列FROM表WHERE前提ORDERBY前提
rsn.CursorType=1游标属性
rsn.CursorLocation=2游标地位
rsn.LockType=1界说数据库查询形式
rsn.Open()翻开数据库链接
rsn.PageSize=RPP界说每页显现纪录数
Ifpageview<=0Thenpageview=1假如pageview小于或即是0,前往值1
Ifpageview>rsn.PageCountThenpageview=rsn.PageCount假如pageview年夜于分页总数,前往分页末页值
rsn.AbsolutePage=pageview界说以后页码
SubShowPageInfo(tPageCount,cPageNo)界说子例程ShowPageInfo,显现页数和总页
Response.WritecPageNo&"/"&tPageCount&"页"显现以后页和总页数
EndSub
SubShowPageNavi(tPageCount,cPageNo)界说子例程ShowPageNavi,显现分页号
IfcPageNo<1ThencPageNo=1假如页数小于1,默许为1;以后页,cPageNo=CurrentPageNO.
IftPageCount<1ThentPageCount=1
IfcPageNo>tPageCountThencPageNo=tPageCount
DimNaviLength
NaviLength=10显现数字链接数
DimI,StartPage,EndPage界说以后页,入手下手页,停止页
StartPage=(cPageNoNaviLength)*NaviLength+1为入手下手页赋值
ifpageview=1then判别是不是首页,假如是首页不增加链接,反之增加.
Response.Write"<fontcolor=""#CCCCCC"">首页</font>"显现没有增加链接热门的"首页"
Else
Response.Write"<ahref="&dyv_&rqsyv_&dyvpv_&"1>首页</a>"首页链接
EndIf
If(cPageNoModNaviLength)=0ThenStartPage=StartPage-NaviLength
EndPage=StartPage+NaviLength-1
IfEndPage>tPageCountThenEndPage=tPageCount
IfStartPage>1Then向后挪动一分页,十页为一分页,而且以1,11,21...为每页的入手下手篇数
Response.Write"<ahref="&dyv_&rqsyv_&dyvpv_&(cPageNo-(cPageNomod10)-NaviLength+1)&">"&previous10_&"</a>"
Else
Response.Write"<fontcolor=""#CCCCCC"">"&previous10_&"</font>"
EndIf
Ifpageview1andpageview0Then后移一页
Response.Write"<ahref="&dyv_&rqsyv_&dyvpv_&(pageview-1)&">"&previous1_&"</a>"
Else
Response.Write"<fontcolor=""#CCCCCC"">"&previous1_&"</font>"
EndIf
ForI=StartPageToEndPage
IfI=cPageNoThen
Response.Write"<b>"&I&"</b>"
Else
Response.Write"<ahref="&dyv_&rqsyv_&dyvpv_&I&">"&I&"</a>"
EndIf
IfItPageCountThenResponse.Write""
Next
Ifpageviewrsn.PageCountandpageview0Then前移一页
Response.Write"<ahref="&dyv_&rqsyv_&dyvpv_&(pageview+1)&">"&next1_&"</a>"
Else
Response.Write"<fontcolor=""#CCCCCC"">"&next1_&"</font>"
EndIf
IfEndPage<tPageCountThen向前挪动一分页,十页为一分页,而且以1,11,21为每页的入手下手篇数
Response.Write"<ahref="&dyv_&rqsyv_&dyvpv_&(cPageNo-(cPageNomod10)+NaviLength+1)&">"&next10_&"</a>"
Else
Response.Write"<fontcolor=#CCCCCC>"&next10_&"</font>"
EndIf
ifrsn.PageCountpageviewthen判别是不是尾页
Response.Write"<ahref="&dyv_&rqsyv_&dyvpv_&rsn.PageCount&">尾页</a>"
Else
Response.Write"<fontcolor=""#CCCCCC"">尾页</font>"
EndIf
EndSub
%>
<divCLASS="center">
<formNAME="pageform"ID="pageform">
<%showPageNavirsn.PageCount,pageview%>
<selectNAME="menu1">
<%fori=1torsn.PageCount%>
<optionVALUE="<%=dyv_&rqsyv_&dyvpv_&i%>"
<%ifpageview=ithen%>selected<%endif%>>
第<%=i%>页
</option>
<%next%>
</select>
</form>
<%showPageInforsn.PageCount,pageview%><%Response.Write(rsn.RecordCount)%>篇<br/>
</div>
<%
Ifrsn.EOFORrsn.BOFThen
Else
ForI=1Torsn.PageCount
%>
<%=(pageview-1)*RPP+I%>
<%=rsn("dateandtime")%><ahref="<%=a1_&rsn("article.classid")&a2_&rsn("article.nclassid")&a3_&rsn("articleid")%>"><%=rsn("title")%></a><p/>
<%
rsn.MoveNext
Ifrsn.EOFORrsn.BOFThenExitFor
Next
EndIf
%>
<divCLASS="center">
<formNAME="pageform"ID="pageform">
<%showPageNavirsn.PageCount,pageview%>
<selectNAME="menu1">
<%fori=1torsn.PageCount%>
<optionVALUE="<%=dyv_&rqsyv_&dyvpv_&i%>"
<%ifpageview=ithen%>selected<%endif%>>
第<%=i%>页
</option>
<%next%>
</select>
</form>
</div>
<%rsn.close
setrsn=nothing%>
---/-------------------------------------------------------------------
abbr.asp
<%
SiteInfomation
sitename_="绿色学院GreenInstitute"站点名字
homepageW_="首页"
siteurl_="http://127.0.0.1:83"站点域名
home_="<ahref="&siteurl_&">"&sitename_&"</a>"_fcksavedurl=""&siteurl_&">"&sitename_&"</a>""显现站名并加上首页链接
homepage_="<ahref="&siteurl_&">"&homepageW_&"</a>"显现"首页"并加站站点链接
sitepublic_="开站日期:2006-7-1"显现开站日期
siteadmin_="shawl.qiu"
siteadminW_="站长"
siteadminMail_="shawl.qiu@gmail.com"站长电子邮件
contactSiteAdmin_=siteadminW_&":<aHREF=mailto:"&siteadminMail_&">"&siteadmin_&"</a>"_fcksavedurl="mailto:"&siteadminMail_&">"&siteadmin_&"</a>""显现站长名字并加上电子邮件链接
NumberControl
n10_=10显现文章题目长度
n11_=11显现文章题目长度
n12_=12显现文章题目长度
n15_=15显现文章题目长度
HTMLTag
b_="<br/>"挪用换行符
p_="<p/>"
sp2_=""
sp2a_="->"
articleabout
author_="作者:"
hot_="抢手"
source_="来历:"
newPost_="<divclass=center>最新宣布</div>"
previousA_="上篇"
nextA_="下篇"
previous10_="上十"
next10_="下十"
previous1_="上一"
next1_="下一"
nullPA_="没有上篇"
nullNA_="没有下篇"
view_="检察:"
viewT_="次"
pagelinkW_="页面链接:"
Generalword
welcomeShort_="接待到临"
siteFoundtime_="开站日期:"
localsite_="本站"
pageindex.asp
pColumn_="父类"
sColumn_="子类"
pageclass.asp
c1_="class.asp?classid="class类一级链接
c2_="&nclassid="class类二级链接
pagearticle.asp
a1_="article.asp?classid="article页一级链接
a2_="&nclassid="article页二级链接
a3_="&articleid="article页三级链接
text_="注释:"
pagedateview.asp
ddv_="dateview.asp?dayview="
dyv_="dateview.asp?yearview="
dyvpv_="&pageview="
dmv_="dateview.asp?monthview="
dwkv_="dateview.asp?weekview="
dtv_="dateview.asp?todayview="
show_="显现"
today_="明天"
showAll_="一切文章"
showByW_="所属礼拜"
errorinfo
errorCidNidAid_="<metaHTTP-EQUIV=refreshCONTENT=3;URL=index.asp><metahttp-equiv=Content-Typecontent=text/html;charset=utf-8/><center>页面毛病,三秒后前往主页</center>"
errorNothing_="<center>没有内容</center>"
errorNJH_="<metaHTTP-EQUIV=refreshCONTENT=3;URL=index.asp><metahttp-equiv=Content-Typecontent=text/html;charset=utf-8/><center>没有内容,三秒后前往主页</center>"
querystring
rqsyv_=request.QueryString("yearview")
url
pagelink1_=siteurl_&request.ServerVariables("URL")&"?"&request.ServerVariables("QUERY_STRING")
pagelink_=pagelinkW_&"<ahref="&pagelink1_&">"&pagelink1_&"</a>"
%>
---/-------------------------------------------------------------------
/****************************************************************
*
*subject:
*
*author:Stabx<shawl.qiu@gmail.com>
*
*blog:http://btbtd.exblog.jp//http://my.opera.com/btbtd/
*
*blogname:Phoenix.GI-P.GI
*
*date:2006-4-17
*
****************************************************************/
ASP在国内异常流行,因为国内大多使用的是盗版的Windows和盗版的SQLServer,而ASP+COM+SQLServer实际上也是一种不错的搭配,其性能也不输于PHP+MYSQL,特别是Windows系统和SQLServer都有图形界面,比APACHE和MYSQL易于维护,因此对于不重视知识产权的国家来说也是一种不错的选择。 |
|