数据库显示,要是没有值的话,它会报一个错误(如下),我想避免出现这样的错误,要怎么做啊?

myhenry 2005-07-14 12:01:57

数据库一表格的形式显示在前端
在同一个网页中,如果有一个表根据多个条件分别显示在各自的表中。

sqlcmd="select * from table1 where id1=1"
set rs2=conn.execute(sqlcmd)
do while rs2.eof=false
表格显示
rs2.movenext
loop

sqlcmd="select * from table1 where id1=2"
set rs2=conn.execute(sqlcmd)
do while rs2.eof=false
表格显示
rs2.movenext
loop

如果这样的话,要是没有值的话,它会报一个错误(如下),我想避免出现这样的错误,要怎么做啊?

Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft VBScript 运行时错误 错误 '800a01a8'
缺少对象: ''
/schedule/CurrentSettings.asp,行309
...全文
70 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lindy730 2005-07-14
  • 打赏
  • 举报
回复
上面的都对
wxiaol 2005-07-14
  • 打赏
  • 举报
回复

sqlcmd="select * from table1 where id1=1"
set rs2=conn.execute(sqlcmd)
if rs2.eof and rs2.bof then
response.write("Sorry``数据库为空.")
else
do while rs2.eof=false
表格显示
rs2.movenext
loop
end if
MOTA 2005-07-14
  • 打赏
  • 举报
回复
if rs.eof and rs.bof then
response.write("Sorry``数据库为空.")
end if
放在execute下面
wxylvmnn 2005-07-14
  • 打赏
  • 举报
回复
sqlcmd="select * from table1 where id1=1"
set rs2=conn.execute(sqlcmd)
do while rs2.eof=false
表格显示
rs2.movenext
loop
rs2.close
set rs2=nothing
set conn=nothing



sqlcmd="select * from table1 where id1=2"
set rs2=conn.execute(sqlcmd)
rs2.movefirst
do while rs2.eof=false
表格显示
rs2.movenext
loop
rs2.close
set rs2=nothing
set conn=noting

28,406

社区成员

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

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