%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
const recpage=31
dim i,currentpage,id,sql,allrec,totalpage,csql,ftitle
if request.QueryString("id")<>"" then
id=Cint(request.QueryString("id"))
else
id=1
end if
if(id<>1) then
set rs=conn.execute("select title from t_catalog where id="&id)
if not rs.eof then
ftitle=rs(0)
end if
rs.close
set rs=nothing
else
ftitle="新闻动态"
end if
if not isempty(request.QueryString("page")) then
currentpage=Cint(request.QueryString("page"))
else
currentpage=1
end if
%>
<%
csql="select count(*) AS co from t_news where 1=1"
if(id>0) then
csql=csql&" and catalogid="&id
end if
set rs=server.createobject("adodb.recordset")
rs.open csql,conn,3,1
allrec=rs(0)
totalpage=int((allrec+recpage-1)/recpage)
rs.close
set rs=nothing
set rs=server.createobject("adodb.recordset")
sql="select top "&recpage&" id,title,modtime,content from t_news where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_news where 1=1"
if(id>0) then
sql=sql&" and catalogid="&id
end if
sql=sql&" order by id desc) as t)"
if(id>0) then
sql=sql&" and catalogid="&id
end if
sql=sql&" order by id desc "
rs.open sql,conn,3,1
if rs.eof or rs.bof then
response.Write("