 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
& ^. g Y4 X! H9 Z S" X set conn=server.createobject("ADODB.CONNECTION")% F# \4 P' a* W$ S6 W
if err.number<>0 then * g7 A9 I$ v/ T1 i, C
err.clear
- }- H% ^* G( m6 {# G# o set conn=nothing! n& s/ O/ J' W; w# L) }6 p. ?7 x
response.write "数据库连接出错!"
( M$ s" c* h! y7 O1 ~ Response.End+ u$ c, r2 Z9 U, t6 E7 [
else7 ]' B7 T: A+ Y& _* O7 y
conn.open connstr
6 n" T: U# W u) e ?) V; [ if err then - {6 U! D0 l6 L' B( w+ ?5 f
err.clear
6 H+ l3 W! t* y1 x! v1 L8 w4 A set conn=nothing
% ?: u5 G' Q1 E& L/ s response.write "数据库连接出错!"* \! ?, E6 l% T1 _- _% C
Response.End 2 _+ A& }4 D' t9 y8 D
end if" g6 r3 n9 E9 \, T: c( F
end if0 _) k( b6 ^8 C! @" s: y: N
看错了你的问题。有可能是你的server.mappath设置的问题。
4 a, b- u. N7 `# d2 p" j/ z* P) _. S
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|