[asp数据库连接出错]asp数据库连接代码

更新时间:2016-10-05    来源:Access    手机版     字体:

【www.bbyears.com--Access】

"本文章提供一款比较完美的asp数据库连接代码哦,他不但连接access数据库同时也包括了数据库断开连接代码函数。
dim conn,rs,sql,dbpath
set conn=server.createobject("adodb.connection")
dbpath="web_data.asp"  "数据库路径
call conndate()

sub conndate()
 if err then err.clear
 on error resume next
 conn.open "provider = microsoft.jet.oledb.4.0;data source = " & server.mappath(dbpath)
 if err then
  err.clear
  set conn=nothing
  response.write "

www.111cn.net提示你抱歉,数据库连接错误。
"
  response.end
 end if
end sub

sub closeconn()
    on error resume next
    if isobject(conn) then
        conn.close
        set conn = nothing
    end if
    if err then err.clear
end sub
%>

本文来源:http://www.bbyears.com/shujuku/27320.html

猜你感兴趣