ASP网页制作 怎么从数据库里调取最新文章题目,显示在网页里

各位大侠,小弟初学ASP和数据库,基本不怎么明白
现在有段代码,从数据库里调取的最新的一条文章题目和一些文章内容,我想实现调取多几条文章题目,不用显示文章内容,应该怎么修改代码啊
现在得代码如下:
<!--#include file="Inc/conn.asp"-->
<head>
<title><%=SiteTitle%>|<%=SiteTitle2%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="<%=SitePath%>images/css4.css" type=text/css rel=stylesheet>
<%If rss=1 then%>
<%end if%>
</head>
<body>

<div class="mw" style="width: 197px; height: 16px">

<div class="topnews">
<%
set rs1=server.createobject("ADODB.Recordset")
sql1="select Top 1 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"
rs1.open sql1,conn,1,3
If Not rs1.Eof Then
do while not (rs1.eof or err)
%><h4><a href="<%=IIF(html=1,"List.asp?ID="&rs1("ID")&"","Html/?"&rs1("ID")&".html")%>" target=_blank><%If rs1("TitleFontColor")<>"" then Response.Write("<font style=""color:"&rs1("TitleFontColor")&""">") End if%><%=rs1("Title")%><%If rs1("TitleFontColor")<>"" then Response.Write("</font>") End if%></a></h4>
<div class="topjx"> <%=left(LoseHtml(rs1("ArtDescription")),60)%>……[<a href="<%If html=1 then Response.Write("List.asp?ID="&rs1("ID")&"") else Response.Write("Html/?"&rs1("ID")&".html") End if%>" target=_blank>详细</a>]</div>
<%
rs1.movenext
loop
end if
rs1.close
set rs1=nothing
%>
</div>

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

请问怎么修改啊
分不多,就这么点,全给了。谢谢各位大侠了
谢谢两位大侠,但怎么让那个文章内容不显示啊,现在改成5了 但也只显示两条,每条下面都有一些内容,我想要内容不显示,只显示题目

而且现在改成多少也只显示两条啊!

你查一下你的库,是不是你里面符合这种条件的记录只有两条

<%
set rs1=server.createobject("ADODB.Recordset")
sql1="select Top 5 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"
rs1.open sql1,conn,1,3
If Not rs1.Eof Then
do while not (rs1.eof or err)
%><h4><a href="<%=IIF(html=1,"List.asp?ID="&rs1("ID")&"","Html/?"&rs1("ID")&".html")%>" target=_blank><%If rs1("TitleFontColor")<>"" then Response.Write("<font style=""color:"&rs1("TitleFontColor")&""">") End if%><%=rs1("Title")%><%If rs1("TitleFontColor")<>"" then Response.Write("</font>") End if%></a></h4>

<%
rs1.movenext
loop
end if
rs1.close
set rs1=nothing
%>
温馨提示:内容为网友见解,仅供参考
第1个回答  2009-04-30
sql1="select Top 1 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"

中的 Top 1 ID 那里,你可以修改1的数字,比如你要5条,就可把此语句改为
sql1="select Top 5 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"
第2个回答  2009-04-30
1 看你的样子,你是要将文件名全部显示吗?
2 select Top 1 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc中Top 1,不是只显示一个的意思吗?
3 还有,数据库选择的时候,你是打算在怎么选择呢?模糊查询不是也可以一下子选择出几个名称相似的文件吗?
你到网上好好找找资料吧
第3个回答  2009-04-30
sql1="select Top 10 ID,Title,Images,ArtDescription,TitleFontColor from Yao_Article where yn = 0 and IsTop = 1 and IsHot = 1 order by DateAndTime desc"

这是选取前10条记录
相似回答