请问此段程序有问题吗?为什么运行的时候总是好久不显示结果?
这是通过一个表里的数据查询另外一个表里是否也有,如果有并显示出来
但运行好长时间都不显示结果,
<table>
<tr> <td> 条码 </td> </tr>
<%
sql= "select * from webhz "
set rs=server.createobject( "adodb.recordset ")
rs.open sql,conn
do while rs.eof <> true
tiaoma=rs( "tiaoma ")
set rs1=server.createobject( "adodb.recordset ")
rs1.open "select * from oraclee where tiaoma= ' "&tiaoma& " ' ",conn
if rs1.eof <> true then%>
<tr> <td> <%=rs1( "tiaoma ")%> </td> </tr>
<%
end if
rs1.close
rs.movenext
loop
rs.close
%>
</table>
------解决方案--------------------rs1.close
set rs1=nothing
rs.close
set rs=nothing
注意释放
可能是数据库数据量太大.
------解决方案--------------------每循环一次都set 一次rs1而且不释放,优化一下吧,
sql= "select O.tiaoma from webhz W left outer join oraclee O on W.tiaoma=O.tiaoma "
rs.open sql,conn,1,1
do while not rs.eof
if not isnull(rs( "tiaoma ")) then
response.write rs( "tiaoma ")
end if
rs.movenext
loop
rs.close
------解决方案-------------------- <table>
<tr> <td> 条码 </td> </tr>
<%
sql= "select * from webhz "
set rs=server.createobject( "adodb.recordset ")
set rs1=server.createobject( "adodb.recordset ")
rs.open sql,conn,1,3
do while not rs.eof
tiaoma=rs( "tiaoma ")
rs1.open "select * from oraclee where tiaoma= ' "&tiaoma& " ' ",conn,1,3
if Not rs1.eof then
%>
<tr> <td> <%=rs1( "tiaoma ")%> </td> </tr>
<%
end if
rs.movenext
loop
rs1.close
set rs1=nothing
rs.close
set rs=nothing
%>
</table>