 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
W8 K9 f+ B9 k* Q; c, K set conn=server.createobject("ADODB.CONNECTION")3 C% q$ _0 x; C( T: V% e& h
if err.number<>0 then
! B8 _3 e% M: B/ G5 g err.clear) B) ~1 n- ~2 Z* F- ?# J, f, k
set conn=nothing
. I, R! j1 [* _- s$ T response.write "数据库连接出错!"
6 E: X( U& m3 N) V- l0 |1 @1 ?8 \( j. [ Response.End
% f. A; t8 W5 s/ F( z else
/ E1 f. c# t9 g8 x2 O- e conn.open connstr2 t3 x0 }4 n; S2 B9 |4 S+ t
if err then
6 {5 O; K F" [& M* B: k4 j err.clear
# T u) l- r9 R$ x- N1 s set conn=nothing5 J, @1 {0 g( R0 H2 F7 O
response.write "数据库连接出错!"8 P% N& e* P9 M9 y$ M
Response.End
4 S7 S" z) } t4 L1 f5 T- J end if
# |1 r4 J9 Z8 g( @0 K" m; n end if/ t) {) U' `! T" O4 B: J
看错了你的问题。有可能是你的server.mappath设置的问题。 H5 Z' `, P' {! C, O& R/ j2 g$ k$ Y. [
( a/ A( y, e6 `% o; c9 ]# E# I[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|