关于asp sql获取两个表数据的代码问题

代码如下,运行时死机无错误提示请高手找找问题所在数据库表station_order车站表train_list车次表<tablewidth="300"border="1"c... 代码如下,运行时死机无错误提示
请高手找找问题所在
数据库表 station_order 车站表 train_list 车次表

<table width="300" border="1" cellpadding="1" cellspacing="0" bordercolor="#0000FF">
<% station_name=trim(request("ccc_station_name"))
set rs=server.createobject("adodb.recordset")
rs.open "select station_order.train_code as a1,station_order.station_name as a2,station_order.train_time as a3,station_order.distance as a4,train_list.start_station as b1,train_list.start_time as b2,train_list.stop_station as b3,train_list.stop_time as b4, from station_order,train_list where station_order.train_code in(select * from station_order where station_name like '%" & station_name &"%') and station_order.train_code = train_list.train_code",conn,1,1

do while not rs.eof%>
<tr>
<td class="xiahuaCopy"><%=rs("a1")%></td>
<td class="xiahuaCopy"><%=rs("a2")%></td>
<td class="xiahuaCopy"><%=rs("a3")%></td>
<td class="xiahuaCopy"><%=rs("a4")%></td>
<td class="xiahuaCopy"><%=rs("b1")%></td>
<td class="xiahuaCopy"><%=rs("b2")%></td>
<td class="xiahuaCopy"><%=rs("b3")%></td>
<td class="xiahuaCopy"><%=rs("b4")%></td>
</tr>
<% rs.close
set rs=nothing
loop%>
</table>
改成
<% rs.movenext
loop
rs.close
set rs=nothing
%>
还是死机。是sql语句有问题吧,谁知道啊
展开
 我来答
51site
2010-05-28 · TA获得超过2853个赞
知道大有可为答主
回答量:1775
采纳率:0%
帮助的人:2240万
展开全部
你怎么先把数据库关闭了才循环啊!肯定祥腊不行的啊!
<table width="300" border="1" cellpadding="1" cellspacing="0" bordercolor="#0000FF">
<% station_name=trim(request("ccc_station_name"))
set rs=server.createobject("adodb.recordset")
rs.open "select station_order.train_code as a1,station_order.station_name as a2,station_order.train_time as a3,station_order.distance as a4,train_list.start_station as b1,train_list.start_time as b2,train_list.stop_station as b3,train_list.stop_time as b4, from station_order,train_list where station_order.train_code in(select * from station_order where station_name like '%" & station_name &"%') and station_order.train_code = train_list.train_code",conn,1,1

do while not rs.eof%>
<tr>
<td class="xiahuaCopy"><%=rs("a1")%></td>
<td class="xiahuaCopy"><%=rs("a2")%></弊宴姿租绝td>
<td class="xiahuaCopy"><%=rs("a3")%></td>
<td class="xiahuaCopy"><%=rs("a4")%></td>
<td class="xiahuaCopy"><%=rs("b1")%></td>
<td class="xiahuaCopy"><%=rs("b2")%></td>
<td class="xiahuaCopy"><%=rs("b3")%></td>
<td class="xiahuaCopy"><%=rs("b4")%></td>
</tr>
<% rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
华夏日长兴
推荐于2016-05-06 · TA获得超过9592个赞
知道大有可为答主
回答量:6305
采纳率:85%
帮助的人:3720万
展开全部
两个错误:模卜好
1、station_order.train_code in(select * from station_order where station_name like '%" & station_name &"%')
这个地方in里边的seldct不能用select * 应该指定一个具体的字段
2、do while not rs.eof%>
<tr>
<td class="xiahuaCopy"><%=rs("a1")%></td>
<td class="xiahuaCopy"><%=rs("a2")%></td>
<td class="xiahuaCopy"><%=rs("a3")%></td>
<td class="xiahuaCopy"><%=rs("a4")%></td>
<td class="xiahuaCopy"><%=rs("b1")%></旦铅td>
<td class="xiahuaCopy"><%=rs("b2")%></td>
<td class="xiahuaCopy"><%=rs("b3")%></td>
<td class="xiahuaCopy"><%=rs("弊蠢b4")%></td>
</tr>
<% rs.movenext
loop
rs.close
set rs=nothing
%>
</table>

loop 应该放在 rs.close set rs=nothing 之前
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
wuqiao5257
2010-05-28 · TA获得超过2090个赞
知道大有可为答主
回答量:776
采纳率:100%
帮助的人:1320万
展开全部
你的循环写错了,请按下面的更正:

<table width="300" border="1" cellpadding="1" cellspacing="0" bordercolor="#0000FF">
<% station_name=trim(request("ccc_station_name"))
set rs=server.createobject("adodb.recordset")
rs.open "select station_order.train_code as a1,station_order.station_name as a2,station_order.train_time as a3,station_order.distance as a4,train_list.start_station as b1,train_list.start_time as b2,train_list.stop_station as b3,train_list.stop_time as b4, from station_order,train_list where station_order.train_code in(select * from station_order where station_name like '%" & station_name &"%') and station_order.train_code = train_list.train_code",conn,1,1

do while not rs.eof%>
<tr>
<td class="xiahuaCopy"><%=rs("a1")%></td>
<td class="xiahuaCopy"><%=rs("a2")%></td>
<td class="xiahuaCopy"><%=rs("a3")%></td>
<td class="xiahuaCopy"><%=rs("a4")%></td>
<td class="xiahuaCopy"><%=rs("b1")%></td>
<td class="xiahuaCopy"><%=rs("b2"李激)%><则唤/td>
<td class="xiahuaCopy"><%=rs("b3")%><孙扰凯/td>
<td class="xiahuaCopy"><%=rs("b4")%></td>
</tr>
<%
rs.movenext
loop
%>
<%
rs.close
set rs=nothing
%>
</table>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
rzf_w2
2010-05-28 · TA获得超过129个赞
知道小有建树答主
回答量:232
采纳率:0%
帮助的人:215万
展开全部
do while not rs.eof%>
<tr>
<td class="xiahuaCopy"><%=rs("缓亮a1")%></td>
<td class="xiahuaCopy"><%=rs("a2")%></td>
<td class="xiahuaCopy"><%=rs("a3")%></td>
<td class="xiahuaCopy"><%=rs("a4")%>祥高</td>
<td class="xiahuaCopy"><%=rs("b1")%></td>
<td class="xiahuaCopy"><%=rs("b2")%></td>扰宴宽
<td class="xiahuaCopy"><%=rs("b3")%></td>
<td class="xiahuaCopy"><%=rs("b4")%></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
jjlion2008
2010-05-28
知道答主
回答量:15
采纳率:0%
帮助的人:0
展开全部
<table width="300" border="1" cellpadding="1" cellspacing="0"扒腔拆 bordercolor="#0000FF">
<% station_name=trim(request("ccc_station_name"))
set rs=server.createobject("adodb.recordset")
rs.open "select station_order.train_code as a1,station_order.station_name as a2,station_order.train_time as a3,station_order.distance as a4,train_list.start_station as b1,train_list.start_time as b2,train_list.stop_station as b3,train_list.stop_time as b4, from station_order,train_list where station_order.train_code in(select * from station_order where station_name like '%" & station_name &"%') and station_order.train_code = train_list.train_code",conn,1,1

do while not rs.eof%>
<tr>
<td class="xiahuaCopy"><%=rs("a1")%></td>
<td class="xiahuaCopy"><%=rs("a2")%></td>
<td class="xiahuaCopy"><%=rs("a3")%></td>
<td class="xiahuaCopy"><%=rs("a4")%></td>
<td class="xiahuaCopy"><%=rs("b1")%></td>
<td class="xiahuaCopy"><%=rs("b2")%></td>春枣
<td class="xiahuaCopy"><%=rs("b3")%></td>
<td class="xiahuaCopy"><%=rs("b4")%></td>
</tr>圆扮
<%
rs.movenext
rs.close
set rs=nothing
loop%>
</table>

中间少了一句:rs.movenext,死循环啦.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(4)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式