熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp入門實例-讀取數據庫程序

2013-11-13 10:37:55  來源: .NET編程 

  <!#include file="connasp">
<!DOCTYPE html PUBLIC "//WC//DTD XHTML Transitional//EN" "
<html xmlns="
<head>
<meta httpequiv="ContentType" content="text/html; charset=gb" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="" rel="stylesheet" type="text/css" />
<style type="text/css">
<!
#web {marginleft:auto; marginright:auto; width:px; height:auto; textalign:left; margin: auto}
A {float:left; width:%; height:auto; border:px solid #CCC; background:#FFF;}
A ul {float:left; liststyletype:none;}
A li {margintop:px; marginbottom:px;}
B {float:left; width:%; height:px;}
>
</style>
</head>
<body>
<div id="web">
<div class="A">
<ul>
<%
i=
set rs=servercreateobject("adodbrecordset") 
sql ="select * from 表 order by 日期 Desc"
rsopen sqlconn
if rseof then
%>
沒有文章
<%
else
do while not rseof
%>
<li><a href="<%=rs("路徑")%>" target="_blank"><%=rs("標題")%></a></li>
<%
i=i+
if i>= then exit do     顯示條數
rsmovenext
loop
end if
rsclose
%>
</ul>
</div>
<!廣告>
<div class="B"><br/>廣告位置</div>
<div class="A">
<ul>
<%
i=
set rs=servercreateobject("adodbrecordset") 
sql ="select * from 表 where 自動排列字段 not in (select top 自動排列字段 from 表 order by 日期 Desc) order by 日期 Desc"
rsopen sqlconn
if rseof then
%>
沒有文章
<%
else
do while not rseof
%>
<li><a href="<%=rs("路徑")%>" target="_blank"><%=rs("標題")%></a></li>
<%
i=i+
if i>= then exit do     顯示條數
rsmovenext
loop
end if
rsclose
%>
</ul>
</div>
</div>
</body>
</html>


From:http://tw.wingwit.com/Article/program/net/201311/14165.html
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.