【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 "
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
%>