<%
if ClassID="" then
sql="select * from news order by DateTime desc"
else
sql="select * from news where class like '"&ClassID&"%' order by DateTime DESC"
end if
set rec= Server.CreateObject("adodb.recordset")
rec.open sql,conn,1,1
if not rec.eof then
rec.pagesize=10
iCount=rec.RecordCount '記錄總數(shù)
iPageSize=rec.PageSize
maxpage=rec.PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rec.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
end if
i=1
%>
<%while not rec.eof and i<= iPageSize%>
<%i=i+1
rec.movenext
wend
rec.close
set rec=nothing%>
<%
call PageControl(iCount,pagecount,page,table_style,font_style)
%> |
|