ASP排序的错误?没碰到过

来源:百度知道 编辑:UC知道 时间:2024/05/26 13:48:42
我是这样写的,但是这样写检测的是暂时没有评论,但是当我把倒序排列去了的话就可以检测出来,是正序,请教高手是怎么回事
<%
if request.querystring("act")="pl" then
rst.open "select * from zk_comment where company_id="&id,conn,1,1
%>
(当我把这一行改为:rst.open "select * from zk_comment where company_id="&id&"order by comment_id desc",conn,1,1时却显示有评论,问题出在哪呢?注:"&id&"改为'"&id&"'效果一样,我认为这句没有问题,问题可能在下面,如能解决非常感谢!
<%
if rst.eof and rst.bof then
response.Write("暂时无评论")
else
do while not rst.eof
%>
<tr>
<td height="20" colspan="2" valign="top">服务: <%=rst("fuwu")%></td>
<td width="129" valign="top">质量: <%=rst("zhiliang")%></td>
<td width="121" valign="top">环境: <%=rst("huanjing")%></td>
<td width

"&id&"改为'"&id&"'效果一样,那company_id字段可能是字符型的吧?
你确认一下,如果真的是,就应该这么改:
rst.open "select * from zk_comment where company_id='"&id&"'",conn,1,1

你去数据库看下你的company_id,是不是int,是不是主键,是不是自动增长的.
估计错误就在库那边.