当前位置: 代码迷 >> ASP >> 怎么判断连接access失败
  详细解决方案

怎么判断连接access失败

热度:269   发布时间:2012-03-29 12:53:12.0
如何判断连接access失败
如下代码:

Dim   MM_test_STRING
Dim   ThatPath  
Dim   conn
Set   conn=Server.CreateObject( "ADODB.Connection ")
ThatPath   =   Server.MapPath( "\Databases\ASP_CF\Relative_Realty.mdb; ")
MM_test_STRING   =   "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   &   ThatPath
conn.open(MM_test_STRING)

这句conn.open(MM_test_STRING)有否返回值,如何判断连access是否失败?
在线等

------解决方案--------------------
set conn=server.CreateObject( "adodb.connection ")
connstr= ".... "
err.clear
conn.Open connstr
if err.number =0 then
... ‘正确
else
... '错误
end if

------解决方案--------------------
if err <> " " then
response.write "connection wrong "
end if
  相关解决方案