日期:2012-01-01  浏览次数:20784 次

default.asp
'下面就是本站首页显示的样本程序:http://asp.on.net.cn/
'适用与本站所有的首页显示程序。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ASP动感在线 http://ASP.on.net.cn</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<p>首页模板!最新5条信息!</p>
<table width="60%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="60%" valign="top" height="54">
<table width="100%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr>
<td height="5">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" height="8"><%
dim conn
dim connstr

on error resume next
connstr="DBQ="+server.mappath("/new/new.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
dim sql
dim rs
sql="select top 5 * from learning order by articleid desc"
Set rs= conn.execute(sql)

if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 文 章</p>"
else
%><%do while not rs.eof%><font color="#000099">○</font> <a href="<%=rs("url")%>" target="_blank"><%=rs("title")%></a>
<i><font color="#FF0000">(<%=rs("dateandtime")%>)</font></i><br>
<%=rs("content")%><br>
<%
rs.movenext
loop
rs.close
end if

set rs=nothing
conn.close
set conn=nothing
%> </td>
</tr>
<tr>
<td colspan="2">
<div align="right"><a href="new/index.asp">以前公告>></a></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div align="center"> </div>
</td>
</tr>
</table>


</div>
</body>
</html>


作者:阿喔 出处:<ASP动感在线> http://asp.on.net.cn/

(待续)