 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" - o, c9 m. F" i
set conn=server.createobject("ADODB.CONNECTION")
! y, q, ]3 m) D; Y- [ if err.number<>0 then
+ x& K3 B' J0 V! g: Y err.clear
9 ?" b3 d/ c! j7 K set conn=nothing
7 ~8 z8 }- _0 Q# W5 p9 i( ]7 ? response.write "数据库连接出错!"& S: B6 f' v; U2 z0 q! L; i- m6 i
Response.End! l2 T. D: ?2 _. W, g( d \
else
. F, [5 q7 u! c1 @0 Y/ | conn.open connstr, w0 G; S( S* J" K* V
if err then ' _8 i1 e! B& H' E9 o/ ~# x
err.clear
, h8 X7 u6 I! W8 h. R set conn=nothing
( h4 O$ u# y8 [0 }+ G/ s' q response.write "数据库连接出错!"
% O S8 N$ X- D* r& ]9 a Response.End
4 C! y% o- R+ S3 X9 Z; G( f end if
* M! g# Z7 M3 `# g' J; @2 ^ end if
7 ^5 D6 e3 D3 V* b& d% g看错了你的问题。有可能是你的server.mappath设置的问题。/ |/ a! q; I! d+ A0 v( S
+ O" j3 `1 F8 N$ B- [7 r[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|