 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" ( }& u4 S5 x h6 a5 b
set conn=server.createobject("ADODB.CONNECTION")- l' m$ u X, h# y: T
if err.number<>0 then " z& `2 X7 K4 M1 g- `
err.clear2 T3 p$ Q* U# k6 r. S
set conn=nothing, \# ]6 F8 i" D8 k
response.write "数据库连接出错!"$ M4 F) j U; s, K
Response.End. |+ D, ]2 h/ i3 L( D
else
3 F* q% P" H3 W8 l) s7 M# k6 H conn.open connstr
% S) h8 h' x5 h* E0 Q5 g, d if err then 9 {% }5 z1 R! B: V2 n
err.clear
e2 \" f# I' W set conn=nothing/ u- J, i6 K* }" h! \! \. E
response.write "数据库连接出错!"+ ]; \) u2 u9 z. ?& \: ~( I
Response.End 9 ^# G+ l3 |; H" H" Q$ D0 M
end if, h8 ^1 A" c' P! y6 n# v2 d. J
end if
7 @8 z: G: n3 }1 O# p# m" @看错了你的问题。有可能是你的server.mappath设置的问题。
& C7 F7 @' H. G" F( k- c' g! X4 R) U M) Z3 u0 V2 p2 n0 w
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|