www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > opendb.asp
<%Option Explicit Response.Buffer = true%> <!--#include file="common/fzr.asp" --> <!--#include file="cnkdata/dbname.asp" --> <!--#include file="common/config.asp"--> <% dim conn dim connstr dim db db = UpDir&"cnkdata/"&dbname connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db) 'On Error Resume Next Set conn = Server.CreateObject("ADODB.Connection") conn.open connstr If err then err.clear Set conn = nothing response.write "数据库连接出错,请检查连接字串。" response.End End If sub closedb() conn.close set conn=nothing end sub %> <!--#include file="common/function.asp"--> <!--#include file="common/char.asp"--> <!--#include file="common/Display.asp" -->