 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" V/ S) f- h. Z* d; |2 {
set conn=server.createobject("ADODB.CONNECTION")
5 U M6 m! f7 c) t if err.number<>0 then & }3 I8 G k& V: w7 D- a/ |
err.clear
" Z: j- Z3 t, i" I( P* P' d: P set conn=nothing
2 p3 \; |* B, ]+ F/ H0 ^ response.write "数据库连接出错!"0 I' [: {* u: `- d) m+ t
Response.End
" X! u, n% n0 a& ^/ [7 T9 q else
: a' E5 }/ k. Y: N# u0 a) @4 C' a+ r conn.open connstr
, b* d. r9 Y; n5 O8 L if err then
( o2 i9 R' `) B. |4 w7 c/ |* B& y s err.clear- u; X0 U8 V$ n4 e
set conn=nothing
, v3 v3 }# o* Y response.write "数据库连接出错!"
5 `8 X# F5 J7 l R Response.End
% K) F6 K8 l5 { end if
4 ~! j( z& Q+ P, K- g end if
* I/ Z; M9 ?8 V7 @; v看错了你的问题。有可能是你的server.mappath设置的问题。
5 ^$ |! U6 \: R E6 u7 Q# x
8 w' P7 \, T c[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|