日期:2014-05-17  浏览次数:20955 次

如何判断连接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