<%@ LANGUAGE = VBScript CodePage = 936%>
<%
option explicit
Response.Buffer = true
Dim dataname,startime,conn,db
startime = timer()
%>
<!--#include file="conn_name.asp" -->	
<%
'定义数据库类别，1为SQL数据库，0为Access数据库
Const isSqlDataBase = 0
Dim SqlString
Dim ConnStr
If IsSqlDataBase = 1 Then
	'-----------------------SQL数据库连接参数-------------------------------------
	Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName
	SqlString = "GetDate()"
	SqlDatabaseName = "xuanxi"     '数据库名
	SqlPassword = "xuanxi"          '用户密码
	SqlUsername = "xuanxi"          '用户名
	SqlLocalName = "(local)"        '连接名（本地用local，外地用IP）
	ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
	'-----------------------------------------------------------------------------
Else
	'-----------------------ACCESS数据库连接--------------------------------------
	Dim InstallDir
	SqlString = "Now()"
	InstallDir = Replace(Left(LCase(Request.ServerVariables("SCRIPT_NAME")), InStrRev(LCase(Request.ServerVariables("SCRIPT_NAME")), "/")),"admin/","")
	'ACCESS数据库连接，如果要修改数据库名称请打开conn_name.asp修改
	db = InstallDir & "Database/" & DataName
	Connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
	'------------------------------------------------------------------------------
End If
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 CloseConn()
	If IsObject(DownsysClass) Then
		Set DownsysClass = Nothing
	End If
	If IsObject(Conn) Then
		Conn.Close
		Set Conn = Nothing
	End If
End Sub
%>