展会信息港展会大全

asp入门实例-读取数据库程序
来源:互联网   发布日期:2016-03-01 11:05:33   浏览:1908次  

导读:!--#include file=conn.asp-- !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml head meta http-equiv=Content-Type content=text/html; ch...

<!--#include file="conn.asp"-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title></title>

<meta name="keywords" content="" />

<meta name="description" content="" />

<link href="" rel="stylesheet" type="text/css" />

<style type="text/css">

<!--

#web {margin-left:auto; margin-right:auto; width:600px; height:auto; text-align:left; margin:0 auto}

.A {float:left; width:100%; height:auto; border:1px solid #CCC; background:#F8F8F8;}

.A ul {float:left; list-style-type:none;}

.A li {margin-top:8px; margin-bottom:8px;}

.B {float:left; width:100%; height:100px;}

-->

</style>

</head>

<body>

<div id="web">

<div class="A">

<ul>

<%

i=0

set rs=server.createobject("adodb.recordset")

sql ="select * from 表 order by 日期 Desc"

rs.open sql,conn,1,1

if rs.eof then

%>

没有文章

<%

else

do while not rs.eof

%>

<li><a href="<%=rs("路径")%>" target="_blank"><%=rs("标题")%></a></li>

<%

i=i+1

if i>=8 then exit do'显示条数

rs.movenext

loop

end if

rs.close

%>

</ul>

</div>

<!--广告-->

<div class="B"><br/>广告位置</div>

<div class="A">

<ul>

<%

i=0

set rs=server.createobject("adodb.recordset")

sql ="select * from 表 where 自动排列字段 not in (select top 10 自动排列字段 from 表 order by 日期 Desc) order by 日期 Desc"

rs.open sql,conn,1,1

if rs.eof then

%>

没有文章

<%

else

do while not rs.eof

%>

<li><a href="<%=rs("路径")%>" target="_blank"><%=rs("标题")%></a></li>

<%

i=i+1

if i>=8 then exit do'显示条数

rs.movenext

loop

end if

rs.close

%>

</ul>

</div>

</div>

</body>

</html>

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港