 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
8 F `$ n! W% V7 I- E& } set conn=server.createobject("ADODB.CONNECTION"): |1 k- [) |; T$ t
if err.number<>0 then . K6 \, \ R6 {) X" ~- [
err.clear
6 }! Z" R5 G8 @( h, W set conn=nothing
8 J! v7 ?+ ]5 ^: G: W- i4 u/ j response.write "数据库连接出错!"0 k' b* B, A9 z' w" I4 V; w. M! G
Response.End
! o: ]& c4 \/ d6 L; v* h, g) p% H else q4 q* ~& t4 u: h! d
conn.open connstr" h, ~6 y, }" @ g/ r
if err then / C8 I/ Q, J) x$ l$ C7 U2 {6 B
err.clear; Y$ Q0 _3 o' ~4 [' y' c
set conn=nothing# ?3 v" l8 K6 N q2 B# H7 Y
response.write "数据库连接出错!"& ]* ~* o$ x( C+ l
Response.End
1 p y0 l2 N# E5 K# L/ { end if4 ~' j2 x+ E$ z# e5 Y8 X
end if
6 L5 F% V8 o( l3 Z! x8 |% Z看错了你的问题。有可能是你的server.mappath设置的问题。
7 j; k( Y2 d0 M1 m4 l
- Q' ~1 ^, K0 B: d* Q[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|