绿色背景是我改的,用DSN连接,红色背景是原来的。这个我不太懂,还请高人指点下,谢谢!
<%
Dim SqlNowString,SiteSN,Conn,DBPath,CollectDBPath,DataServer,DataUser,DataBaseName,DataBasePsw,ConnStr,CollcetConnStr
Const DataBaseType=0 '系统数据库类型,"1"为MS SQL2000数据库,"0"为MS ACCESS 2000数据库
Const MsxmlVersion=".3.0" '系统采用XML版本设置
Const EnableSiteManageCode = True '是否启用后台管理认证码 是: True 否: False
Const SiteManageCode = "8888" '后台管理认证码,请修改,这样即使有人知道了您的后台用户名和密码也不能登录后台
If DataBaseType=0 then
'如果是ACCESS数据库,请认真修改好下面的数据库的文件名
DBPath = "/KS_Data/KesionCMS5.mdb" 'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径
SqlNowString = "Now()"
Else
'如果是SQL数据库,请认真修改好以下数据库选项
DataServer = "(local)" '数据库服务器IP
DataUser = "sa" '访问数据库用户名
DataBaseName = "KesionCMS5" '数据库名称
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
Set Connstr = Server.CreateObject("ADODB.Connection")
dsnName = "XXXX" 'The name of the DSN
dsnUser = "XXXX" 'The username for the DSN
dsnPass = "XXXX" 'The password for the DSN
Conn.Open "DSN="&dsnName, dsnUser, dsnPass
'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
'==============================================全局临时变量类开始==============================
Dim GCls:Set GCls=New GlobalVarCls
Class GlobalVarCls
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
Set GCls=Nothing
End Sub
Function GetUrl()
On Error Resume Next
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
If Request.ServerVariables("SERVER_PORT") <> 80 Then
strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
end if
strTemp = strTemp & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then
strTemp = strTemp & "?" & Trim(Request.QueryString)
end if
GetUrl = strTemp
End Function
'====================标志来访地址================
Public Property Let ComeUrl(ByVal strVar)
Session("M_ComeUrl") = strVar
End Property
Public Property Get ComeUrl
ComeUrl= Session("M_ComeUrl")
End Property
'================================================
End Class
'==============================================全局临时变量类结束==============================
%>
绿色背景是我改的,用DSN连接,红色背景是原来的。这个我不太懂,还请高人指点下,谢谢!