库中找不到该记录,但没出现报错语句

Bluebamboo 2002-07-22 11:13:14
我想让程序实现若在库中找不到该记录,报错,代码如下,但当库中找不到该记录时,页面上是什么都没有,而不是我所期望的报"无资料"的语句,请教!

mysql="select dwmc from mytable where xm='"& name &"'" &" and xh='" & code & "'"
on error resume next
set rst=cnn.execute(mysql,1,1)
%>
<html>
<head>
<title>查询系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%
if err.number<>0 then
response.write"hihi"
response.write "<font color='#66CC66' size='5' face='隶书'>无资料</font>"
response.end
end if
do while not (rst.bof and rst.eof)
rst.close
set rst=nothing
cnn.close
set cnn=nothing
%>
...全文
42 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cmsoft 2002-07-22
  • 打赏
  • 举报
回复
<%
if rst.eof then
response.write "<font color='#66CC66' size='5' face='隶书'>无资料</font>"
else
do while not (rst.bof and rst.eof)
repsponse.write rs("xm")
rst.movenext
loop
end if
rst.close
set rst=nothing
cnn.close
set cnn=nothing
%>
cmsoft 2002-07-22
  • 打赏
  • 举报
回复
<%
if rst.eof then
response.write "<font color='#66CC66' size='5' face='隶书'>无资料</font>"
else
do while not (rst.bof and rst.eof)
repsponse.write rs("xm")
rst.movenext
loop
end if
rst.close
set rst=nothing
cnn.close
set cnn=nothing
%>
cmsoft 2002-07-22
  • 打赏
  • 举报
回复
<%
if rst.eof then
response.write "<font color='#66CC66' size='5' face='隶书'>无资料</font>"
else
do while not (rst.bof and rst.eof)
repsponse.write rs("xm")
rst.movenext
loop
end if
rst.close
set rst=nothing
cnn.close
set cnn=nothing
%>
gshope 2002-07-22
  • 打赏
  • 举报
回复
if err.number<>0 then

改成
if rst.eof then
gshope 2002-07-22
  • 打赏
  • 举报
回复
if err.number<>0 then

改成
if rst.eof then
blackcatiii 2002-07-22
  • 打赏
  • 举报
回复
无资料不是出错!
你可以用
if rst.eof and rst.bof then
response.write "无资料"
else
do while not rst.eof
response.write "详细资料在此显示"
rst.movenext
loop
end if

28,391

社区成员

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

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