关于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个回答
展开全部
不死机才怪呢! 进入死循环了,改成这样.
if rs.eof and not rs.bof then
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
end if
rs.close()
set rs=nothing
%>
if rs.eof and not rs.bof then
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
end if
rs.close()
set rs=nothing
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询