http://127.0.0.1/ff/ff.asp显示空白,进入死循环?

pgyssg 2005-06-14 08:05:41
<%@ language=VBScript %>
<%
Option Explicit
Response.Expires=0
Dim con, Strcon
Set con=Server.CreateObject("ADODB.Connection")
Strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("aa.mdb")
con.Open Strcon

Dim StrSQL, rs
StrSQL="Select * from address_list"
Set rs=con.Execute(StrSQL)
%>

<html>
<body>
<%
Do While Not rs.EOF
Response.Write rs("姓名")&" "&rs("性别")&" "&rs("年龄")&" "&"<br>"
rs.MoveNext
Loop
con.close
Set rs=Nothing: Set con=Nothing
%>
</body>
</html>
这段代码是不是进入死循环了?
如何修改?
...全文
118 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
richwong 2005-06-14
  • 打赏
  • 举报
回复
同意楼上说法
jackycxg 2005-06-14
  • 打赏
  • 举报
回复
打开记录集的时候加个判断啦
你这应该没有死循环的呀

没有错误提示吗?
con.close
Set rs=Nothing: Set con=Nothing
这里先关了con.close的话,就不能再set rs=nothing了吧
他们的位置是这样
rs.close
set rs=nothing
con.close
set con=nothing
pgyssg 2005-06-14
  • 打赏
  • 举报
回复
不会,不关那个
lzfxpuugv 2005-06-14
  • 打赏
  • 举报
回复
没有死循环,你确认你数据库中有数据吗?显示页是空白还是无法显示
Set rs=con.Execute(StrSQL)这条语句后最好加上
if rs.bof and rs.eof then
response.write "没有任何记录"
response.end
end if
AitStudio 2005-06-14
  • 打赏
  • 举报
回复
Loop
con.close
Set rs=Nothing: Set con=Nothing
%>

改成:
Loop
rs.close
Set rs=Nothing
con.close
Set con=Nothing
%>
popcom 2005-06-14
  • 打赏
  • 举报
回复
Response.Write rs("姓名")&" "&rs("性别")&" "&rs("年龄")&" "&"<br>"
这句好象没有写对,应该这样
response.write ""&rs("姓名")&" "&rs("性别")&""&rs("年龄")&" "

28,406

社区成员

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

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