 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
: R8 I ?5 e* H7 n set conn=server.createobject("ADODB.CONNECTION")
/ G+ f) h$ y8 ^# Y if err.number<>0 then
, h2 `5 Q6 K0 w' j- s) ]- f err.clear' H$ N0 Q `8 f2 J" T. {- g* v+ A
set conn=nothing
: R1 n8 }" L8 v3 l7 [* J4 S0 j0 }0 p response.write "数据库连接出错!"" B' v* b# ^. s' z& _4 a8 Q
Response.End3 |# G. n' i: m ]3 k1 v
else
) x, P0 o0 J# {+ g4 E conn.open connstr
9 Q6 t' y& b8 Z2 @: m$ n9 \6 [ if err then
8 f4 |* ]5 K# Y9 w err.clear# W! y% K+ O) z! {1 h
set conn=nothing+ i m$ y, M( y1 c1 A
response.write "数据库连接出错!"
+ f! G% _' k. z Response.End ' D! }+ E. c2 n5 w1 |
end if
1 s5 Z# |$ c5 D) g& l end if' l, C4 l; e0 D
看错了你的问题。有可能是你的server.mappath设置的问题。9 O3 h( R& |$ B6 J
. Q% H# u% y, \" |1 A[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|