 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
7 R# |; Z9 `8 a% a# B. N! l set conn=server.createobject("ADODB.CONNECTION")2 }& m2 N, i( D \0 F0 T
if err.number<>0 then
. c: R! m: u/ N) w6 \8 ?! A. ` err.clear
( E9 u9 K# H5 o3 |7 W6 w8 ` set conn=nothing3 h; t0 V, k/ {
response.write "数据库连接出错!"' Q+ B# U* G( T$ u) q% {7 Q
Response.End
9 B# `9 I- F6 H else
/ W; U7 s, I3 k; B* S conn.open connstr) \: J- K0 S. f# ~
if err then
" Y9 m! l- E; F4 n, i+ q4 h! t err.clear7 R" _8 w" j. \3 S; Y
set conn=nothing
" b6 w8 n4 R( m7 f6 {8 K$ @, T response.write "数据库连接出错!"0 L: y" d) p8 F
Response.End 4 n/ G$ I6 F- R8 R4 c% `# q& q* L
end if2 P6 j! h% `/ ^2 n1 Y- W
end if5 k: |' G$ Q/ N5 s
看错了你的问题。有可能是你的server.mappath设置的问题。7 {' `- U6 o- C4 N r
) Q# _) v8 z8 ?- O' h
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|