asp+accessd的问题,总是查询失败

egochina 2006-02-09 09:04:02
<%
set rs=server.createobject("adodb.recordset")
rs.open "select *, shop.shop_name from message,shop where message.shop_id = shop.shop_id order by message_updatetime desc",conn,1,1
%>

message和shop两张表。都有属性列shop_id,这样写连接查询为什么不行呢,在message表中shop_id是数字,我想显示在页面里是shop_id对应的shop_name,
请大家帮我看看问题出在哪呢
--
也不报错,就显示错误页面,换成别的语句就可以查询成功



无法显示网页
您要访问的网页有问题,无法显示。

--------------------------------------------------------------------------------

请尝试以下操作:

打开 localhost 主页,然后查找指向您感兴趣信息的链接。
单击刷新按钮,或以后再试。

单击搜索,寻找 Internet 上的信息。
也可查看相关站点列表。




HTTP 500 - 内部服务器错误
Internet Explorer
...全文
137 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
egochina 2006-02-09
  • 打赏
  • 举报
回复
KimSoft(革命的小酒天天醉) 不好意思,我的问题解决拉,我把分给避雷针了,我第一次问问题,应该也给你分的,我不大清楚,下次一定给你分,真不好意思!
duoduobaba 2006-02-09
  • 打赏
  • 举报
回复
11条记录都符合条件?
egochina 2006-02-09
  • 打赏
  • 举报
回复
记录我已经特意输入11条了。
我的msn:dllpro@hotmail.com qq:30447837
请大家多教教我,很急。
duoduobaba 2006-02-09
  • 打赏
  • 举报
回复
i=0
while i<10 and not rs.eof
...
rs.movenext
i=i+1
wend

别漏了这两句
duoduobaba 2006-02-09
  • 打赏
  • 举报
回复
估计是记录数不足10条 用
i=0
while i<10 and not rs.eof
...
wend
egochina 2006-02-09
  • 打赏
  • 举报
回复
我把那个sql语句换成别的,就可以查找出来,一联合查询就失败
egochina 2006-02-09
  • 打赏
  • 举报
回复
<!--#include file="conn.asp"-->

<%
set rs=server.createobject("adodb.recordset")
rs.open "select a.*,b.shop_name from message a,shop b where a.shop_id = b.shop_id order by a.message_updatetime desc",conn,1,1
%>


<div id="Layer2" style="position:absolute; width:614px; height:80px; z-index:2; left: 276px; top: 267px; visibility: visible;">
<table width="100%" height="47" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFCC">
<% for i=1 to 10 %>
<tr>
<th width="6%" height="45" bordercolor="#CCCCCC" style="font-family: "宋体"" scope="row"><img src="ginga1.jpg" width="34" height="30"> </th>
<td width="17%" bordercolor="#CCCCCC" style="font-family: "宋体""><span class="STYLE4"><%=rs("message_name")%></span></td>
<td width="19%" bordercolor="#CCCCCC" style="font-family: "宋体""><span class="STYLE4">价格: <%=rs("message_price")%>元</span></td>
<td width="11%" bordercolor="#CCCCCC" style="font-family: "宋体""><span class="STYLE4">折扣:</span></td>
<td width="47%" bordercolor="#CCCCCC" style="font-family: "宋体""><span class="STYLE4">所属店铺:<%=rs("shop_name")%> </span></td>
</tr>
<%rs.movenext%>
<% next %>
<%rs.close%>
duoduobaba 2006-02-09
  • 打赏
  • 举报
回复
SQL错误应该不会报500错误
duoduobaba 2006-02-09
  • 打赏
  • 举报
回复
贴出全部代码吧
egochina 2006-02-09
  • 打赏
  • 举报
回复
还是不行,问题出在哪呢?嗨
KimSoft 2006-02-09
  • 打赏
  • 举报
回复
order by a.message_updatetime desc
--如果 message_updatetime 在shop表则改为
order by b.message_updatetime desc
duoduobaba 2006-02-09
  • 打赏
  • 举报
回复
message_updatetime是message表中的?

试试
select b.shop_name,a.* from message a,shop b where b.shop_id = a.shop_id order by a.message_updatetime desc
不行就把下面的代码也贴出来
KimSoft 2006-02-09
  • 打赏
  • 举报
回复
select
a.*,b.shop_name
from
message a,shop b
where
a.shop_id = b.shop_id
egochina 2006-02-09
  • 打赏
  • 举报
回复
还是不行呢,还是失败!
duoduobaba 2006-02-09
  • 打赏
  • 举报
回复
select shop.shop_name,message.* from message,shop where message.shop_id = shop.shop_id order by message.message_updatetime desc

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧