教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 asp数据库连接代码

asp数据库连接代码

发布时间:2016-09-26   编辑:jiaochengji.com
教程集为您提供asp数据库连接代码等资源,欢迎您收藏本站,我们将为您提供最新的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.jiaochengji.com提示你抱歉,数据库连接错误。</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
%>

您可能感兴趣的文章:
asp 全面安全数据连接代码
asp数据库连接代码
ASP设计常见问题及解答精要(2)
ASP 3.0高级编程(三十八)
asp 数据库连接代码与数据库关闭代码
掌握ASP其实只需要6步
asp数据连接函数与关闭
ASP与JSP的比较(二)
检测用户名是否存在
ASP连接SQL Server数据库程序代码

[关闭]
~ ~