1 on error resume next
 2 
 3 connstr="provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath(""&db&"")
 4 
 5 set conn=server.createobject("ADODB.CONNECTION")
 6 if err then
 7     err.clear
 8 else
 9     conn.open connstr
10 end if
11 
12 set rs=server.createobject("adodb.recordset")
13 
14 rs.open "select * from tbl_xxx",conn,1,1
15 
16 if rs.eof then 
17     response.write(" rs.eof ")
18 end if
19 
20 if not rs.eof then 
21     response.write(" Not rs.eof ")
22 end if

执行结果:
“ rs.eof  Not rs.eof ”

这也行,多年不写asp的我百思不得其解。 经过多次尝试终于发现是由于 “on error resume next”屏蔽了错误, 导致出现了我不解的结果。 把这个选项关闭之后,一切的问题就都能定位了。

 

问题及参考:

1. win7 + iis 7 运行asp设置 https://blog.csdn.net/tangdc88/article/details/47190183

asp备忘之调试开关 -- on error resume next

应用程序池设置为经典模式,启用32位
2. connection string使用: connstr="provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath(""&db&"")

3. vbscript on error 总结:https://www.jb51.net/article/17323.htm

 

相关文章:

  • 2022-12-23
  • 2021-05-03
  • 2021-12-26
  • 2021-08-05
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-17
  • 2022-12-23
  • 2021-09-22
  • 2022-02-18
  • 2021-07-18
  • 2021-11-20
相关资源
相似解决方案