<%
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 Aclearcase/" target="_blank" >ccess 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.EOF) and j<rs.PageSize
Response.Write "<tr>"
for i=0 to rs.fields.count-1
if i=1 then
Response.Write "<td>"&"<a href="&chr(34)&"status.asp?BookName="& _
rs.fields.item(i).value&chr(34)&">"&rs.fields.item(i).value&"</a></td>"
"这里这样写是为了级联式查询而做的。
else
Response.Write "<td>"&rs.fields.item(i).value&"</td>"
end if
next
Response.Write "</tr>"
rs.MoveNext
j=j+1
wend
Response.Write "</table>"
end if
%>