<!--#include file=ConnConfig.asp-->
<%
response.charset="UTF-8"
Response.Buffer = True
Dim Conn,ConnXls,Db,rs
'可修改设置一：========================定义数据库类别，1为SQL数据库，0为Access数据库=============================
Const IsSqlDataBase =0
If IsSqlDataBase = 1 Then
	'必修改设置二：========================SQL数据库设置=============================================================
	'sql数据库连接参数：数据库名(SqlDatabaseName)、用户密码(SqlPassword)、用户名(SqlUsername)、
	'连接名(SqlLocalName)（本地用local，外地用IP）
	'================================================================================================================
Else
	'必修改设置三：========================Access数据库设置==========================================================
	Db = Web_C_setupfolder&"#web08data&/#Singe_Web_Shop$.asp"
End If
Sub ConnDB
	Dim ConnStr
	If IsSqlDataBase = 1 Then
		'ConnStr = "Driver={SQL Server};UID=" & T_SqlUsername & ";PWD=" & T_SqlPassword & "; Database="&T_SqlDatabaseName &";Server=" &T_SqlLocalName&";"
		ConnStr = "Provider = Sqloledb; User ID = " & T_SqlUsername & "; Password = " & T_SqlPassword & "; Initial Catalog = " & T_SqlDatabaseName & "; Data Source = " & T_SqlLocalName & ";"
	Else
		
		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.ConnectionTimeOut   =   500   
	conn.open ConnStr
	If Err Then
		
		Response.Write "数据库连接出错，请检查连接字串。"&err.description&ConnStr '
		err.Clear
		Set Conn = Nothing
		Response.End
	End If
End Sub

Sub CloseDB
	conn.close
	Set Conn=Nothing
End Sub

Sub ConnxlsDB(Tpath)
	'On Error Resume Next
     	Set ConnXls=server.createobject("ADODB.CONNECTION")
     	DBpath=server.mappath(tpath)
	'response.write dbpath
	ConnXls.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq="&dbpath&";Extensions=csv;Persist Security Info=False" 
        If Err Then
		err.Clear
		Set ConnXls = Nothing
		Response.Write "xls数据库错误。"&ConnXls '注释，需要把这几个字翻译成英文。
		Response.End
	End If   
END Sub

Sub ClosexlsDB
	ConnXls.close
	Set ConnXls=Nothing
End Sub
%>

 

 
 

