 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
0 m$ ~- j& f. x" o set conn=server.createobject("ADODB.CONNECTION"), i! U( \- ]: ^& L2 a$ H
if err.number<>0 then
' E1 {- z" s3 o, \2 e% E% a: | err.clear
9 Q' R! U' F/ n set conn=nothing1 w2 j* h/ y1 k" ]* I
response.write "数据库连接出错!"1 Z8 u+ i- z) g0 m# b1 {! J
Response.End
; @, i* z- s9 x7 J: s- k else
( w# @0 J D$ P, ~. L7 ~" n conn.open connstr
% c' ]+ v, {* m; H/ B if err then
5 `. J3 a$ T" r, N. G: v err.clear
0 J a; ?. Y4 h% {* L( d set conn=nothing2 k4 M2 U6 t, h0 v4 \3 b% p& _6 _2 N
response.write "数据库连接出错!"
8 e! n; t3 ] C) F4 o- @ Response.End
- c# J% }2 a1 @# {& z# d end if1 W& T$ `+ r' d* L1 M4 V
end if
& u# d* r% W6 y- ~看错了你的问题。有可能是你的server.mappath设置的问题。 ~$ d/ X/ [9 a2 ^' d! {0 y
3 h+ B1 _% ~: L8 |: n/ o8 Q[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|