关于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语句有问题吧,谁知道啊 展开
请高手找找问题所在
数据库表 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语句有问题吧,谁知道啊 展开
6个回答
展开全部
你怎么先把数据库关闭了才循环啊!肯定祥腊不行的啊!
<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>
<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>
展开全部
两个错误:模卜好
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 之前
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 之前
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你的循环写错了,请按下面的更正:
<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>
<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>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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
%>
<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 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,死循环啦.
<% 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,死循环啦.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询