<body>
<%
dim iLen '每页显示的数量
iLen=3
dim TotalNum '公司的总数量
dim page,allpage
dim name
name=request("name")
Set rs=Server.Createobject("ADODB.Recordset")
rs.pagesize=iLen
rs.CursorLocation=3
SQL="select gongname,gongid from tabgong "
if name<>"" then
if ucase(name)<>"[ALL]" then
Sql=SQL & "where gongname like '%" & Replace(name,"'","''") & "%'"
end if
end if
SQL=SQL & " order by gongid desc"
rs.open SQL,conn,1,1
TotalNum=rs.RecordCount
if (TotalNum mod iLen)=0 then
allpage = TotalNum/iLen
else
allpage = int(TotalNum/iLen)+1
end if
if request.querystring("page") = "" then
page = 1
else
page = cint(request.querystring("page"))
'防止越界
if page<1 then page=1
if page>allpage then page=allpage
end if
'定位到当前页
rs.absolutepage=page
%>
<%
dim chname
dat1=request("dat1")
dat2=request("dat2")
chname=request("chekedname")
name=trim(request("CName"))
passwd=trim(request("PASSWRD"))
gooto=trim(request("GooTo"))
If Request("Page")=Empty Then
Page=1
Else
Page=cint(Request("Page"))
End If
%>
<%
set conn=server.createobject("adodb.connection")
connstr="provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\majes.mdb"
conn.open connstr
set CustomerList= server.createobject("adodb.recordset")
sql= "select * from tbuser"
CustomerList.open sql,conn,3,2
if CustomerList.Recordcount=0 then
CustomerList.close
conn.close
response.write "目前没有记录……"
response.end
End If
CustomerList.PageSize = 20
If Not CustomerList.eof Then
CustomerList.AbsolutePage = PAGE
End If
pagecount=CustomerList.pagecount
I=1
do until CustomerList.EOF or I >= CustomerList.PageSize %>
<TR>
<TD width="200" align="center">
<p align="center"><% =CustomerList("id") %>
<TD width="200" align="center">
<p align="center"><% =CustomerList("username") %></TD>
<TD width="200" align="center">
<p align="center"><% =CustomerList("dat") %></TD>
<TD width="200" align="center">
<p align="center"><% =CustomerList("intime") %></TD>
<TD width="200" align="center">
<p align="center"><% =CustomerList("outtime") %></TD>
<TD width="500" align="center">
<p align="center"><% =CustomerList("mem") %></TD>
</TR>
<% CustomerList.movenext
I=I+1
loop
CustomerList.close
conn.close
%>
<%
If page>1 Then
Response.write "<a href=page.asp?page="&page-1&">上一页</a> "
End If
Response.write "页 <font face=Arial><b>"&pagecount&" / "
Response.write page &"</b></font> "
For j=1 to pagecount
IF J <> page THEN
response.write "<a href=page.asp?page="&j&">"&j&"</a> "
End If
Next
If page<pagecount Then
Response.write "<a href=page.asp?page="&page+1&">下一页</a> "
End If
'end select
%>