<%
dim rscate
dim rs
cont = 1
set rscate=server.createobject("ADODB.recordset")
set rs=server.createobject("ADODB.recordset")
rs.open "SELECT * FROM news ORDER BY posttime DESC",dbconnection,1,3
if Cstr(rs("catename"))="系部公告" then
rscate.open "SELECT * FROM news ORDER BY posttime DESC",dbconnection,1,3
rscate.movefirst
do while cont < 6
%>
<TR><TD height=23><IMG height=14 src="image/arrow.jpg" width=35 border=0><%=rscate("title")%></TD>
<TD><SPAN class=STYLE7><%=rscate("posttime")%></SPAN></TD>
</TR>
<%
cont = cont + 1
rscate.movenext
loop
end if
%>
改成
<%
dim rs
set rs=server.createobject("ADODB.recordset")
rs.open "SELECT top 6 * FROM news where cstr(catename)='系部公告' ORDER BY posttime DESC",dbconnection,1,3
if rs.eof and rs.bof then
response.write "<script language='javascript'>alert('没有找到相关信息!');history.go(-1);</script>"
else
do while not rs.eof
%>
<TR><TD height=23><IMG height=14 src="image/arrow.jpg" width=35 border=0><%=rs("title")%></TD>
<TD><SPAN class=STYLE7><%=rs("posttime")%></SPAN></TD>
</TR>
<%
rs.movenext
loop
end if
%>