参考:、
<%
Dim SqlNowString,SiteSN,Conn,DBPath,CollectDBPath,DataServer,DataUser,DataBaseName,DataBasePsw,ConnStr,CollcetConnStr
Const DataBaseType=0 '系统数据库类型,"1"为MS SQL2000数据库,"0"为MS ACCESS 2000数据库
Const SysVer=0
Const MsxmlVersion=".3.0"
'系统采用XML版本设置
If DataBaseType=0 then
'如果是ACCESS数据库,请认真修改好下面的数据库的文件名
DBPath
= "/KS_Data/KesionCMS4.mdb"
'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径
SqlNowString = "Now()"
Else
'如果是SQL数据库,请认真修改好以下数据库选项
DataServer
= "(local)"
'数据库服务器IP
DataUser
= "sa"
'访问数据库用户名
DataBaseName = "kesioncms4"
'数据库名称
DataBasePsw
= "989066"
'访问数据库密码
SqlNowString = "getdate()"
End if
'采集数据库路径
CollectDBPath="\KS_Data\Collect\KS_Collect.Mdb"
Call OpenConn
Sub OpenConn()
On Error Resume Next
If DataBaseType = 1 Then
ConnStr="Provider = Sqloledb; User ID = " & datauser & "; Password = " & databasepsw & "; Initial Catalog = " & databasename & "; Data Source = " & dataserver & ";"
Else
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBPath)
End If
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
If Err Then Err.Clear:Set conn = Nothing:Response.Write "数据库连接出错,请检查Conn.asp文件中的数据库参数设置。":Response.End
CollcetConnStr ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(CollectDBPath)
End Sub
Sub CloseConn()
On Error Resume Next
Conn.close:Set Conn=nothing
End sub
%>