 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
1 Z% J! @/ ^- p" Q( c set conn=server.createobject("ADODB.CONNECTION")
5 A9 b2 C: j! C+ ? if err.number<>0 then
1 B+ X' k' z; U9 V err.clear
, S+ o5 q' _% T set conn=nothing
+ q& V5 M9 V/ y9 P& ?5 t response.write "数据库连接出错!"
: b4 g6 N- ?, ~7 ?, D+ E: Z Response.End
* d5 O1 R4 m, ?3 J else8 T- C* R. w7 T
conn.open connstr
, @( W9 u% o) }' p0 {$ e9 `5 g if err then 8 L3 a0 k4 a; ]" T9 @2 H. |
err.clear
- @% c6 g' m0 }% L set conn=nothing
- V% N3 N3 A3 j8 b+ j1 w response.write "数据库连接出错!"
5 T! E! V" z7 h+ M Response.End
( Y3 r' [, D7 s. B5 H' T0 H end if% f) V2 `) J6 } n# R6 u i
end if
4 m/ d% ?1 [' ?- `1 z/ V1 e看错了你的问题。有可能是你的server.mappath设置的问题。* N' L4 a: s8 V' U9 K' i& r
) e2 `* I( R# F! t: S: n
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|