asp,我只让他打出6条记录,为什么把数据库的所有记录都打出来了呢?请高手帮忙!

来源:百度知道 编辑:UC知道 时间:2024/07/07 11:57:22
<%

id="11"

tt="select top 6 id,x_name,x_leiid,x_baojia,x_top from xianlu order by x_top desc"

tt="select id,x_name,x_leiid,x_baojia,x_top from xianlu where x_leiid="&id&" order by x_top desc"

set er=conn.execute(tt)
while not er.eof
%>

<table width="285" height="34" border="0" cellpadding="0" cellspacing="0" bordercolor="#006600" bgcolor="#FFFFFF">

<tr bgcolor="#FFFFFF">
<td width="210" height="22" bgcolor="#F7FDE8"><%
if trim(er("x_top"))=1 then
%>
  <img src="images/top.gif"> 
<%
else
%>
  <img src="images/ping.gif">
<%
end if
%>
<a href="Xl/Xl_<%=er(

你写了两条啊
tt="select top 6 id,x_name,x_leiid,x_baojia,x_top from xianlu order by x_top desc"

tt="select id,x_name,x_leiid,x_baojia,x_top from xianlu where x_leiid="&id&" order by x_top desc"

删除下面那条,就行了

top与数值型数据匹配查询才起作用

给你答案吧,我也是最近才碰到了, 你一定用的access数据库,access数据库中,当你使用order by test 的时候, 如果数据库中,这个test字段的值相同,会出现你那种情况,我那会也郁闷了,n天