 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
: w$ d6 p7 X9 n# u2 t4 [3 u set conn=server.createobject("ADODB.CONNECTION")0 q- f) ?' _1 ^
if err.number<>0 then ' H* Z* z& l$ `/ P; K; q: z" `$ v
err.clear, O% ^6 _9 `' `- V; {4 e h
set conn=nothing
/ z2 p* w5 F# Y response.write "数据库连接出错!"
* C, O* b7 o: \& p5 o* I! x+ _ Response.End
, y4 K5 i' T6 j9 l2 N0 v else! {: Q% q! a4 {% n5 t6 d; {% Z
conn.open connstr
' d. L* J5 {# J' V% q1 X if err then . b1 O1 `6 X. i/ `
err.clear
v. I, I Y0 r ^9 |8 y1 g set conn=nothing
+ J4 e2 _" n( B9 m response.write "数据库连接出错!"1 Z# r+ _* U% a( Y" J x, n* g4 \
Response.End 4 u/ T3 C, B1 a% z
end if
6 ~4 c0 V* i! A' ] end if( Y" L1 \ l0 w. s( E! Q
看错了你的问题。有可能是你的server.mappath设置的问题。
/ z" W( `) Z ?4 u* M
1 x' y8 H5 h+ q+ w0 a, J[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|