asp 中select 中包含一个保留字

来源:百度知道 编辑:UC知道 时间:2024/05/28 11:34:34
<DIV id=pro>
<UL>
<% i=0 sql="select top 6*from [xyk] by id desc;"
set rs=server.CreateObject("adodb.recordset") 这行144
rs.open sql,conn,1,1
do while not rs.eof
i=i+1
%>
<LI><span class="pic"><img alt=<%=rs(jianjie)%>
src="/upfile/<%=rs("tupian")%>"></span><span
class="title"><%=rs("jianjie")%></a></span>
<% if 1 mod 6=0 then %>
</LI>
<% end if
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

</UL>
</DIV>
select 子句中包含一个保留字,拼写错误或丢失的参数,或标点符号不正确

<%
i=0
sql="select top 6 * from [xyk] order by id desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
i=i+1
%>

"select top 6*from [xyk] by id desc" 这句应该没有什么大问题,就是6*from 之间要加空格,改成
“select top 6 * from [xyk] by id desc”