鲜花( 0) 鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
% Z! q& n# ?, n& Z% u' ` set conn=server.createobject("ADODB.CONNECTION")
5 a3 p' e# ]) V" I4 @ g if err.number<>0 then
. `4 N0 `( o. v' ^ D! S7 [0 r+ @ n err.clear
7 A4 ^( u# W y' |7 w set conn=nothing1 d$ C( H0 R! a* G
response.write "数据库连接出错!"9 b* `# i5 Q% o/ P- O; g3 ?7 L: ?
Response.End
6 d, y1 z$ g8 R6 \. S2 F' E( }, z else
! i5 w Z+ [/ H" D0 X) F conn.open connstr
& n& z. d& T2 e if err then
" B4 q; L8 H1 F/ q& S3 ]. a9 J5 J! z err.clear, {( w$ @4 W. m/ F. Q' u3 @9 Q
set conn=nothing! w. q- o# D+ C) S8 V8 Z3 Z2 V
response.write "数据库连接出错!"/ W# r/ ]9 n. _+ Q
Response.End , F) r( u* k1 X# R9 v! d% }2 {
end if
8 J1 {3 ~2 h" {5 e; ]- y p end if7 G$ o+ L3 r9 i! S1 Y, S) T' I6 n
看错了你的问题。有可能是你的server.mappath设置的问题。* P; u) c ?' Z: C' x
5 J$ s; f* K1 K
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|