 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
+ _5 j6 Q3 s$ Q$ p! p) }7 @ set conn=server.createobject("ADODB.CONNECTION")
" Y- N+ Q4 p% Q, Y* {" j if err.number<>0 then , ~8 s' k, J/ M# i$ o, e: J( ^
err.clear
9 o' k: D' o' R, p8 _ set conn=nothing
0 d8 {8 Y1 Z& \7 Q response.write "数据库连接出错!"
8 N* G3 b( c! G Response.End
. o) T+ a2 H$ u' g/ B; j else
5 Q8 G8 C1 F7 d& u, Z conn.open connstr
( {; I3 P2 `$ m" n9 i, z; r if err then 4 l" L3 p9 E" D$ `9 @% [! i
err.clear
, @* f8 f7 B7 F7 e$ X$ b set conn=nothing' ~0 S& {" S9 s; y
response.write "数据库连接出错!"
; O( w ?0 P' G( A Response.End ; E2 R2 h2 F: a3 y8 }
end if
( y' B$ j( ~0 s/ b [+ d, A" V end if
1 q# w V. v6 t/ n9 m2 J看错了你的问题。有可能是你的server.mappath设置的问题。
7 E/ a7 O$ p" a+ y( S0 ]2 h& u9 y
& i2 n+ I! W- T4 u[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|