 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
5 J. M5 J4 F( e i6 M+ }* e) { set conn=server.createobject("ADODB.CONNECTION")" T z1 i% X8 H/ a
if err.number<>0 then & Y% v T- D2 g
err.clear3 ]$ g# u' M% m6 `6 s. B7 j
set conn=nothing
+ B1 Z2 W( j; [8 S9 M response.write "数据库连接出错!"
% s2 Q4 v: D1 v5 {+ \9 `" r: g1 a Response.End
( _- C5 Z" |" d8 H3 |. S+ Y/ j else% N9 T4 Y8 s' V e2 E
conn.open connstr6 w) ^/ L. V6 W- S7 x. A) ^
if err then
8 {8 K- f% K; F3 w' c1 ? err.clear1 j O% Z" G/ `/ I/ j0 v/ U! C
set conn=nothing
! N! `" f, Y: [7 h% Q, y1 I9 U response.write "数据库连接出错!"
' H: n3 w7 {1 o" N' ~7 D Response.End
5 S( f9 c' E# i7 y, u$ W end if
, \9 S9 s: s- {$ A end if- t+ d5 ]. S9 q7 L1 c" y
看错了你的问题。有可能是你的server.mappath设置的问题。; c. J3 p; v3 O2 a" }& ~$ N8 f- T+ U
3 a _3 \ F# y, {3 `
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|