 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" ' }6 d4 X! ?3 u& R I- N9 a5 I6 ^
set conn=server.createobject("ADODB.CONNECTION"); Y; a3 U6 Z) I; w, t; t
if err.number<>0 then
3 |, x+ }1 X! T- R8 v% L5 l err.clear
) Q' `4 A/ J' Z, o7 I set conn=nothing
: _8 O$ z! ?' Q o0 v# C/ Z7 ] response.write "数据库连接出错!"$ I, j7 b7 X' a0 K7 ~
Response.End2 w+ y# H! _" A3 A# a I2 S$ `, ~% G
else8 ^% ]0 W, B# _! K- f) s* n
conn.open connstr! t, o# J$ q/ L9 u* F
if err then % }9 A. w* h2 e- k$ e: n
err.clear
; T9 }+ V4 |7 M set conn=nothing
- k `* D& {( R4 P, c response.write "数据库连接出错!". n6 t1 O! p* g5 ?* ^* z
Response.End
' X7 _, `/ T: ? end if
5 N+ }* r2 ]( n- _- Y" S9 T5 _) a end if
/ w8 C2 G r+ F8 F w1 F看错了你的问题。有可能是你的server.mappath设置的问题。3 w! A5 k8 v. c. h7 l. M$ f- F
0 d* w$ P) A% b( H, ^
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|