 鲜花( 0)  鸡蛋( 0)
|
connstr = "DBQ=" + server.mappath("yourdatabase") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" . i6 F8 [2 R0 S3 r2 M% N; x* j- q
set conn=server.createobject("ADODB.CONNECTION"); q4 Z$ C' K0 E6 b0 x. l
if err.number<>0 then ! B4 h) h( A% e, ~( r8 s N
err.clear
0 M3 Y/ G& o1 K1 i2 x set conn=nothing( z, L; F9 y" b K3 h
response.write "数据库连接出错!"; u" @! `: k( Z. f, Q+ v- Z
Response.End# u# v/ r6 G& K( h2 ^( t% l9 Z
else( ?" _! `2 a9 K- o
conn.open connstr
4 L4 M* s f& }* A, Q, |9 N! ~# x if err then
0 b. N3 n/ R( M6 o4 L) B err.clear
, F* n5 y2 F9 t! n6 l set conn=nothing: Z0 b+ i! g+ U' U" _9 \
response.write "数据库连接出错!"( ]+ `0 H( P' d8 g
Response.End
' W! {) c3 @1 q4 z/ a& T( W# D end if. ^, i9 T7 L) M+ ?9 x! |
end if
' l6 [$ G4 L! {看错了你的问题。有可能是你的server.mappath设置的问题。) U" W6 j$ o7 N6 y( @
9 {0 \7 u9 d8 S! Q1 [3 q1 d3 B
[ Last edited by Ward on 2004-11-24 at 05:33 PM ] |
|