 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" 0 s# e; ~. B, {: i7 z$ v
set conn=server.createobject("ADODB.CONNECTION")+ o' A5 |& h5 ^: P. Y* ^. B& O
if err.number<>0 then # z- E, Z& g$ }& N1 }6 P% `5 n
err.clear4 I, e0 P1 b' ?$ x* I6 f
set conn=nothing
/ B, w+ s7 a! {: M& C2 f( c response.write "数据库连接出错!"
- A. z. v6 o0 c) k$ Q- C3 } Response.End
3 I0 Z. A: W8 \7 |: R0 ? else4 N7 g' N' D1 l9 W* M% r( m. E8 `
conn.open connstr
# e1 _$ E1 q) W! n if err then + ]; J/ C6 }# o% K
err.clear8 L3 E/ J: R$ G& n, d
set conn=nothing
" a; ?+ S! X" B' u; q* \# X response.write "数据库连接出错!"' X! K$ P5 x" |
Response.End
- J s7 |- q2 r% U9 [. J end if
W7 E# B& ~1 {2 g9 ^. z4 y end if
+ e) V2 g, g J) U看错了你的问题。有可能是你的server.mappath设置的问题。5 X4 Z4 [5 E% [! D ?' |
$ i( W- U+ G2 @. u[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|