|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP.NET和ASP的比较,技术上比较已经没什么可说的了.新一代在大部分程度来说当然是比旧一代好了. 关键看你对所做软件的理解了.因人而定.会写的话也可能比ASP.NET写得更有效率和更方便重用ado|web 实例一:分页显示及导航:
为何我要再提分页的这个成绩呢?由于这是一个最根基的成绩,固然有良多关于分页的文章,但我感觉他们的办法偏于庞杂。其实RecordSet的AbsolutePage就能够轻松的完成分页,当你指定了PageSize属性后,对AbsolutePage指定值就能够翻转到指定的页面。然而假如你想利用AbsolutePage的话,你必需在翻开RecordSet对象之前将它的CursorLocation值设为adUseClient,这个属性是承继Connection对象的一个不异属性的。你也能够在翻开Connection对象之前来设定它。上面是源代码,为了便利,我将导航栏自力成了一个子法式便利人人利用。
<%
sub navigator(PageNo,Target)
Response.Write "<table border=0>"
Response.Write "<tr>"
Response.Write "<td>"
if PageNo>1 then
Response.write "<a href="&chr(34)&Target&"?Page=1"&chr(34)&">┃第一页</a>"
else
Response.Write "┃第一页"
end if
Response.Write "</td>"
Response.Write "<td>"
if PageNo<rs.PageCount then
Response.write"<a href="&chr(34)&Target&"?Page="&PageNo+1&chr(34)&">┃下一页</a>"
else
Response.Write "┃下一页"
end if
Response.Write "</td>"
Response.Write "<td>"
if PageNo>1 then
Response.write "<a href="&chr(34)&Target&"?Page="&PageNo-1&chr(34)&">┃前一页</a>"
else
Response.Write "┃前一页"
end if
Response.Write "</td>"
Response.Write "<td>"
if PageNo<rs.PageCount then
Response.write "<a href="&chr(34)&Target&"?Page="&rs.PageCount&chr(34)&">┃最初一页</a>"
else
Response.Write "┃最初一页"
end if
Response.Write "</td>"
Response.Write "<td>"
Response.Write "┃页次:"&PageNo&"/"&rs.PageCount&"页┃"&rs.PageSize&"笔记录/页┃"
Response.Write "</td>"
Response.Write "<td valign="middle">"
Response.Write "<form action="&chr(34)&Target&chr(34)&" method="&chr(34)&"POST"&chr(34)&">"
Response.Write "<input type="text"size=3 maxlength=4 name="Page">"
Response.Write " <input type="submit"value="转到">"
Response.Write "</form>"
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "</table>"
end sub
%>
<%
const adCmdText=&H0001
const adVarChar=200
const adInteger=3
const adParamInput=&H0001
const adCmdTable=&H0002
const adUseClient=3
const adDate=7
const adLongVarChar=201
set conn=Server.CreateObject("ADODB.Connection")
conn.ConnectionString="Driver={Microsoft Access Driver (*.mdb)};DBQ="& _
Server.Mappath("/source_asp")&"/process/process.mdb;"
conn.Open
%>
<%
const MaxPageSize=5
%>
<html>
<head>
<title> See Book </title>
</head>
<body>
<%
dim i,j,PageNo
set rs=Server.CreateObject("ADODB.RecordSet")
rs.ActiveConnection=conn
rs.CursorLocation=adUseClient
rs.Open "Select * From books",,,adCmdText
if rs.BOF then
Response.Write "接待利用图书,材料办理法式!"
else
rs.PageSize=MaxPageSize
if isempty(Request.QueryString("Page")) then
PageNo=1
elseif cInt(Request.QueryString("Page"))<1 then
PageNo=1
elseif cInt(Request.QueryString("Page"))>rs.PageCount then
PageNo=rs.PageCount
else
PageNo=cInt(Request.QueryString("Page"))
end if
if Request.ServerVariables("Request_Method")="POST" and not Isempty(Request.Form("Page")) then
PageNo=cInt(Request.Form("Page"))
end if
rs.AbsolutePage=PageNo
Response.Write "<table border="0" width="100%">"
Response.Write "<tr><td colspan="&rs.fields.count&">"
Target="books.asp"
call navigator(PageNo,Target) "挪用导航栏
Response.Write "</td></tr>"
Response.Write "<tr>"
for i=0 to rs.fields.count-1
Response.Write "<td>"&rs.fields.item(i).name&"</td>"
next
Response.Write "</tr>"
j=0
while (not rs.EO</p> 缺点:正版成本价格贵(盗版就不说了)、不够安全,大多数服务器用windows系统,没有linux安全 |
|