关于一个表的问题sql

来源:百度知道 编辑:UC知道 时间:2024/05/25 01:00:28
这个表有n条记录,单我只想让主页面显示3行记录,别的记录不显示怎么办?贴码如下:
<%

Set rs=server.createobject("ADODB.recordset")

Sql="select top 3 * from fdNews where style='新闻'order by createDate desc"
后面一直向主页的下面延伸
<table width="214" height="28" border="0" cellpadding="0" cellspacing="0" bgcolor="#F5F2ED">
<tr>
<td width="24" height="28" align="center" valign="middle">
<img src="img/55.gif" width="14" height="11" /></td>
<td width="190" height="28" align="left" valign="middle"><a href="ll.asp?id=<%=rs("id")%>" class="aa" title="<%=rs("title")%>">
<%
str=rs("title&q

<%

Set rs=server.createobject("ADODB.recordset")

Sql="select top 3 * from fdNews where style='新闻'order by createDate desc"
rs.open Sql,conn,1,1
if not rs.eof then
for i=1 to 3
if rs.eof or rs.bof then exit for

%>
<table width="214" height="28" border="0" cellpadding="0" cellspacing="0" bgcolor="#F5F2ED">
<tr>
<td width="24" height="28" align="center" valign="middle">
<img src="img/55.gif" width="14" height="11" /></td>
<td width="190" height="28" align="left" valign="middle"><a href="ll.asp?id=<%=rs("id")%>" class="aa" title="<%=rs("title")%>">
<%
str=rs("title")
i