 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
6 m* |, l D8 e0 h set conn=server.createobject("ADODB.CONNECTION")$ x. W3 s$ h* I2 N/ l: s
if err.number<>0 then
! g$ a. t6 S0 o9 P7 n7 f# ~ err.clear( V3 u" Z' {( e4 E# Y1 E" L v3 F$ d
set conn=nothing* W# O" w, D2 l4 d& y ^2 e7 p
response.write "数据库连接出错!"
! q6 D& w9 ^* ]2 d Response.End
; s3 L( l/ Z" O* | else
. f' r) m. \( A; a. \7 ` conn.open connstr% i+ ~9 {) m) B* D7 V% O% T1 i5 m9 N
if err then
$ G1 k& t q; {, t, {) a* Z m err.clear
: J1 { A, \- s/ Q* ` f set conn=nothing
% {. B! L" n/ H response.write "数据库连接出错!"# {) w# I! Q( k I4 x+ ]
Response.End % o& O/ w3 X# R- n2 h+ f
end if
6 y' _. M$ o& ?, A# L$ }# c: E7 _ end if6 b# G+ j+ p) Q3 K( M# L
看错了你的问题。有可能是你的server.mappath设置的问题。8 ]. b5 Z$ s ?) q' v; I: v
) L. X$ K# i) d q0 ^ ]# b6 E/ h) `7 c
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|