 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" $ T6 I+ l( t/ p5 C& z; F
set conn=server.createobject("ADODB.CONNECTION")
+ e! F) S" ]1 O/ q/ Y if err.number<>0 then & k7 J7 G" w. B; S# ^
err.clear7 L- ^: Q; `0 Z; x& y$ V1 x1 v7 P
set conn=nothing
6 l) V+ |& D: u3 z( K4 `1 b response.write "数据库连接出错!"
2 @7 I" Z4 @4 P Response.End. L6 M4 S8 o) a/ ^& R9 I' R) A
else
- l5 O' t) n3 D5 r1 w* X conn.open connstr
; J. [3 g% F4 W, |7 B if err then
" r7 n5 _% b. S- @ err.clear$ R: Q1 D4 [& \6 \* U
set conn=nothing I: P( V, {( ~% _9 M* b
response.write "数据库连接出错!"8 S4 \/ b. N, ?8 R
Response.End 5 @) B) B' A* v! B, C& }
end if
+ u: U3 U4 q8 r j* g/ N end if9 a G% R m; _( ?* G* \( N6 A5 x
看错了你的问题。有可能是你的server.mappath设置的问题。( M W0 P e# g& I, I" k
S- T2 w; r" p- ]" H[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|