 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" 6 a) l3 n" q! @# Q2 m% f2 w5 K& j
set conn=server.createobject("ADODB.CONNECTION")
2 Z8 W5 c. [* K. c/ H if err.number<>0 then
R9 w1 ^; S9 \( | @% v err.clear4 P( h/ h- B, }, @) K( R
set conn=nothing9 U$ a, |3 o: d- o& e
response.write "数据库连接出错!" X+ v; ]" J" f2 {
Response.End0 {. H$ |: R5 m" H
else
! }0 B9 I$ j; C/ m( Z" \5 r8 u conn.open connstr: p$ x4 p- x; E% M* F% U
if err then ) Z) _- x, C! [) F8 l2 _1 \! C
err.clear1 K& w! n# R8 ?
set conn=nothing( |$ V9 A4 Q4 u; f
response.write "数据库连接出错!"4 m, [/ v; ?- e' E# B5 A
Response.End
" Z5 \# E+ g/ Y6 Q; T: l end if- V6 a4 p/ f6 x+ }. k3 X
end if( w' ?5 n& r1 h5 d
看错了你的问题。有可能是你的server.mappath设置的问题。) G$ L+ n) C; S; J: B3 U6 [
- ~4 ?9 T! _; ]
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|