 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" 3 _) ^9 B* R1 ~( g* }2 T/ ?" o
set conn=server.createobject("ADODB.CONNECTION") U* h; c4 W$ e3 t4 |
if err.number<>0 then
6 M8 H! Y7 r# U" t err.clear
! t G: t) H/ l, p7 b set conn=nothing
+ X. o& ]! L! H) L" ^ response.write "数据库连接出错!"
# C) Q2 t+ D: z, B Response.End) @) i4 u& V6 @4 @
else0 j/ d: j% Q% V. n% k9 \! o2 |# ?
conn.open connstr( x( R# t' ^9 T9 K5 |* e- u3 c
if err then 4 J$ X0 |6 Q/ M) W! C" m4 G/ e
err.clear
/ ]; Z' K; @( B set conn=nothing
- i+ c; K" _. R response.write "数据库连接出错!"
7 A' w& Y8 b+ f9 M" i Response.End - t' q) x2 D8 [+ R; ~% ~) s
end if2 D9 n) b6 Z4 d/ {+ Q8 O8 n: _0 w
end if
/ B/ L( j, S( p, W看错了你的问题。有可能是你的server.mappath设置的问题。
) e) l4 ]+ E8 D: W5 }
- |, F) i$ J; _[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|