ASP中如何用语句判断数据库连接正确?

来源:百度知道 编辑:UC知道 时间:2024/05/13 04:54:18

response.write conn.state
输入1表示连接成功

on error resume next
conn.open connstr
if err then
err.clear
response.clear
response.write "错误!"
response.end
'********如果要继续执行, 请去掉星号之间的代码********
else
response.write "成功!"
'****************************************************
end if

on error resume next
conn.open connstr
if err then
response.write "错误!"
else
response.write "成功!"
end if
err.clear