 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
^3 W" b( b+ }% c$ o+ b set conn=server.createobject("ADODB.CONNECTION") o+ T. }2 Q) E4 j
if err.number<>0 then
, T9 H2 Y7 ?2 f! B/ X err.clear
' j; A/ `9 G1 | set conn=nothing
0 v! t& f5 r$ g K response.write "数据库连接出错!"
) `. i' ^9 @" R$ S3 N U, U+ M4 g Response.End
2 Q$ e- p- n' p: a else
' L. b8 r" y( V) n" `8 `* S% X9 @& r$ ]+ r conn.open connstr: n2 Z; T* ?7 v, |9 y
if err then ) F' V: M3 K+ x9 l/ w( {! x, a6 q
err.clear0 C4 j! H N& q* [, I! j
set conn=nothing$ S5 S4 Y" ^0 h' |9 W/ M6 @7 ~
response.write "数据库连接出错!"2 ^" I- m: E" M8 P7 Y! d7 l
Response.End
* x g2 U o3 V& ^$ c/ t' \ \ end if6 Q+ j3 y( b% q
end if
3 X2 q' M. X W. F: d0 u: y) p+ T看错了你的问题。有可能是你的server.mappath设置的问题。( z6 [4 w- [. a4 K, c
/ m2 G6 V3 }4 t# Z' G9 L9 h) |[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|