打开数据库失败,请检查Conn.asp中的设置!
我用的是空间架网Conn.asp代码如下看下哪里要改:<%DimConnSubConnOpen()'OnErrorResumeNextDimConnStrConnStr=...
我用的是空间架网Conn.asp代码如下看下哪里要改:
<%
Dim Conn
Sub ConnOpen()
'On Error Resume Next
Dim ConnStr
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath( DBPath & "Inc/^%$#@!HEIMAO.HM")
Set Conn = Server.CreateObject("Adodb.Connection")
Conn.Open ConnStr
If Err Then
Err.Clear()
Set Conn = Nothing
Response.Write "打开数据库失败,请检查Conn.asp中的设置!"
Response.End
End If
End Sub
Sub ConnClose()
On Error Resume Next
If IsObject(Conn) Then
Conn.Close
Set Conn = Nothing
End If
End Sub
Function RegStr(Pattern,Str,ErrMsg)
Dim RegEx
Set RegEx = new RegExp
RegEx.Pattern = Pattern
If Not RegEx.Test(Str) Then
Response.Write "<script>alert('" & ErrMsg & "');history.go(-1);</script>"
Response.End
End If
Set Reg = Nothing
End Function
Function RegReplace(Pattern,Str,RStr)
Dim RegEx
Set RegEx = new RegExp
RegEx.Pattern = Pattern
RegEx.IgnoreCase = True
RegEx.Global = True
RegReplace = RegEx.Replace(Str,RStr)
Set RegEx = Nothing
End Function
Function SafeStr(strContent)
strContent = Trim(strContent)
strContent = Replace(strContent,"'","")
strContent = Replace(strContent,"""","")
strContent = RegReplace("<SCRIPT[^<]*</SCRIPT>",strContent,"")
strContent = RegReplace("<[^>]*>",strContent,"")
strContent = RegReplace("<IFRAME[^<]*</IFRAME>",strContent,"")
strContent = RegReplace("<OBJECT[^<]*</OBJECT>",strContent,"")
strContent = RegReplace("<FRAMESET[^<]*</FRAMESET>",strContent,"")
SafeStr = strContent
End Function
Call ConnOpen()
'初使化网站基本信息
Dim RsConfig,Name,Url,Notice,IsClose,CloseInfo,Tips
Set RsConfig = Conn.Execute("Select * From Config")
Name = RsConfig("Name")
Url = RsConfig("Url")
Notice = Server.HtmlEnCode(RsConfig("Notice"))
IsClose = RsConfig("IsClose")
CloseInfo = Server.HtmlEnCode(RsConfig("CloseInfo"))
Tips = Server.HtmlEnCode(RsConfig("Tips"))
Set RsConfig = Nothing
%> 展开
<%
Dim Conn
Sub ConnOpen()
'On Error Resume Next
Dim ConnStr
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath( DBPath & "Inc/^%$#@!HEIMAO.HM")
Set Conn = Server.CreateObject("Adodb.Connection")
Conn.Open ConnStr
If Err Then
Err.Clear()
Set Conn = Nothing
Response.Write "打开数据库失败,请检查Conn.asp中的设置!"
Response.End
End If
End Sub
Sub ConnClose()
On Error Resume Next
If IsObject(Conn) Then
Conn.Close
Set Conn = Nothing
End If
End Sub
Function RegStr(Pattern,Str,ErrMsg)
Dim RegEx
Set RegEx = new RegExp
RegEx.Pattern = Pattern
If Not RegEx.Test(Str) Then
Response.Write "<script>alert('" & ErrMsg & "');history.go(-1);</script>"
Response.End
End If
Set Reg = Nothing
End Function
Function RegReplace(Pattern,Str,RStr)
Dim RegEx
Set RegEx = new RegExp
RegEx.Pattern = Pattern
RegEx.IgnoreCase = True
RegEx.Global = True
RegReplace = RegEx.Replace(Str,RStr)
Set RegEx = Nothing
End Function
Function SafeStr(strContent)
strContent = Trim(strContent)
strContent = Replace(strContent,"'","")
strContent = Replace(strContent,"""","")
strContent = RegReplace("<SCRIPT[^<]*</SCRIPT>",strContent,"")
strContent = RegReplace("<[^>]*>",strContent,"")
strContent = RegReplace("<IFRAME[^<]*</IFRAME>",strContent,"")
strContent = RegReplace("<OBJECT[^<]*</OBJECT>",strContent,"")
strContent = RegReplace("<FRAMESET[^<]*</FRAMESET>",strContent,"")
SafeStr = strContent
End Function
Call ConnOpen()
'初使化网站基本信息
Dim RsConfig,Name,Url,Notice,IsClose,CloseInfo,Tips
Set RsConfig = Conn.Execute("Select * From Config")
Name = RsConfig("Name")
Url = RsConfig("Url")
Notice = Server.HtmlEnCode(RsConfig("Notice"))
IsClose = RsConfig("IsClose")
CloseInfo = Server.HtmlEnCode(RsConfig("CloseInfo"))
Tips = Server.HtmlEnCode(RsConfig("Tips"))
Set RsConfig = Nothing
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询