<%@ LANGUAGE = "VBScript" CodePage = 936%>
<%
option explicit
Dim Startime,Endtime,Conn,Connstr,DB
Startime = Timer()
DB = "data/itlearner.MDB" '数据库路径
ConnectionDatabase
Sub ConnectionDatabase
Connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
'如果你的服务器采用较老版本Access驱动,请用下面连接方法
'Connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & 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
End Sub
Function CloseDatabase
Conn.close
Set Conn = Nothing
End Function
%>