 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
' J, c5 Z- C9 U* p set conn=server.createobject("ADODB.CONNECTION"), ^+ y8 M' n4 o+ H: u
if err.number<>0 then * R! L3 c# s) a1 _$ m$ w
err.clear
: H! r( Y O( Y2 H4 A1 ~ set conn=nothing2 l& l' p w1 m. z( ?; ?+ i4 u- L' o
response.write "数据库连接出错!"1 z, B8 R# \7 D. H5 c# K, H$ `
Response.End
; g! t6 J# s9 w/ X else3 F; |3 G X5 j- y' @4 d* d' {+ n* n4 x
conn.open connstr
1 _) T4 X7 {2 {3 r6 I* ~0 B if err then
0 o4 g) G; d* ^5 h; m err.clear& z0 p8 c! n/ n3 S9 `5 V" c1 \
set conn=nothing! S2 q. x; d$ C0 }
response.write "数据库连接出错!"
1 r/ V+ [0 K# C3 Y( ] Response.End
- H9 a6 l, }& T end if
5 j+ J4 r' g5 Y* ]) g6 d1 L: d& a end if
9 ^2 T2 t- v4 b0 b/ |: ~看错了你的问题。有可能是你的server.mappath设置的问题。2 U. g" `* B4 G# s& C
7 Z' f+ c0 P# u8 }5 f/ Y# G
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|