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数据库程序代码