<p>
<table border="0" width="318" height="21" cellpadding="2" style="text-indent: 0; border-top: 2 dotted #008080; border-bottom: 2 dotted #008080">
<%dim sql2
dim rs2
sql2="select * from news order by new_date desc"
Set rs2= Server.CreateObject("ADODB.Recordset")
rs2.open sql2,conn2,1,1
if rs2.eof and rs2.bof then
response.write "<p align='center'> 还 没 有 任 何 网 友 留 言 信 息</p>"
else
totalPut2=rs2.recordcount
totalPut2=rs2.recordcount
if CurrentPage2<1 then
CurrentPage2=1
end if
if (CurrentPage2-1)*MaxPerPage2>totalPut2 then
if (totalPut2 mod MaxPerPage2)=0 then
CurrentPage2= totalPut2 \ MaxPerPage2
else
CurrentPage2= totalPut2 \ MaxPerPage2 + 1
end if
end if
if CurrentPage2=1 then
showContent
showpage totalPut2,MaxPerPage2,"news.asp"
else
if (CurrentPage2-1)*MaxPerPage2<totalPut2 then
rs2.move (CurrentPage2-1)*MaxPerPage2
dim bookmark2
bookmark2=rs2.bookmark2
showContent
showpage totalPut2,MaxPerPage2,"news.asp"
else
CurrentPage2=1
showContent
showpage totalPut2,MaxPerPage2,"news.asp"
end if
end if
' rs2.close
end if
' set rs2=nothing
' conn2.close
' set conn2=nothing
sub showContent
dim i
i=0%>
<%do while not rs2.eof%>
<tr>
<td width="18" height="15">☆</td>
<td width="195" height="15"><a href="javascript:view(<%=rs2("id")%>)"><%=rs2("new_zhuti")%></a></td>
<td width="83" height="15"><%=rs2("new_date")%> </td>
</tr>
<% i=i+1
if i>=MaxPerPage2 then exit do
rs2.movenext
loop
%>
<%
end sub
%>
</table>
<p>
</td>
</tr>
</table>
</body>
</html>
下面是conn4.asp的代码:
<%
dim conn2
dim connstr2
on error resume next
connstr2="DBQ="+server.mappath("database.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn2=server.createobject("ADODB.CONNECTION")
conn2.open connstr2
%>
<!--#include file="conn.asp" -->
<%
set rst=server.createobject("adodb.recordset")
sqltext5="select top 1 * from Product where P_tuijian='yes' order by regtime desc"
rst.open sqltext5,conn,1,1
set rs=server.createobject("adodb.recordset")
sqltext="select top 3 * from Product order by regtime desc"
rs.open sqltext,conn,1,1
%>
显示完一次查询的结果后,就关一次。
<% While Not rs.EOF %>
<%=rs("id")%>
<%
rs.MoveNext
Wend
rs.close
%>
<% While Not rst.EOF %>
<%=rst("id")%>
<%
rst.MoveNext
Wend
rst.close
%>