龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > asp编程 >

asp数据库连接代码

时间:2012-12-31 22:56来源:未知 作者:admin 点击:
分享到:
asp教程数据库教程连接代码 '本文章提供一款比较完美的asp数据库连接代码哦,他不但连接access数据库同时也包括了数据库断开连接代码函数。 dim conn,rs,sql,dbpath set conn=server.createobject

asp教程数据库教程连接代码
'本文章提供一款比较完美的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 "<center><font color=red>www.111cn.net提示你抱歉,数据库连接错误。</font></center>"
  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
%>


精彩图集

赞助商链接