 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" $ r5 v) L( E7 e2 u
set conn=server.createobject("ADODB.CONNECTION")3 b# h/ i1 z S1 u' O
if err.number<>0 then
: R+ j" `, i. s: e0 ^5 w err.clear5 B/ S. Q; q$ c. E# o3 R! \5 C
set conn=nothing
1 \9 z9 T0 G z) W response.write "数据库连接出错!"" y Q4 ]( D; n! ?9 R$ M& C
Response.End
5 p \4 w; u# r* @6 F0 F/ ~ else5 r! f4 ?6 N- h7 [4 Q7 y1 X
conn.open connstr
- u1 u5 \. Q$ L- Z8 L Q" U7 y if err then 6 f1 \- `4 _6 I1 G! J
err.clear
8 Z. R# {* H Y* [ set conn=nothing, z, D2 l2 W! M6 _5 g# @
response.write "数据库连接出错!"
; w( ]3 u: Q4 H- V1 h Response.End
" a" D: F; _0 I( O# h1 ? end if8 \, L$ g; P0 x) T- n. s
end if: n* z) x5 I3 W. ^# t4 n
看错了你的问题。有可能是你的server.mappath设置的问题。9 s" I% [1 K6 Y, R1 x- H$ o
% ^! N! j* @& J6 l0 I. [
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|