提示“数据库连接出错,请检查Conn.asp中的数据库指向。”
下了一个网站源码,在人家的XP上能运行,但在自己的WIN7(64位)下运行不了,提示这个“数据库连接出错,请检查Conn.asp中的数据库指向。Provider=Micr...
下了一个网站源码,在人家的XP上能运行,但在自己的WIN7(64位)下运行不了,提示这个“数据库连接出错,请检查Conn.asp中的数据库指向。Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Web\admin\#sundxShopmianfei.mdb”
有人说是WINDOWS\TEMP文件限权问题,也有说是数据库路径有问题,我搞了半天也没搞好。
下面是CONN.ASP文件源码:
<%
dim conn,connstr,startime,sundxDB,rs,UserAgent
startime=timer()
UserAgent = Trim(Lcase(Request.Servervariables("HTTP_USER_AGENT")))
If InStr(UserAgent,"teleport") > 0 or InStr(UserAgent,"webzip") > 0 or InStr(UserAgent,"flashget")>0 or InStr(UserAgent,"offline")>0 Then
Response.Write "请不要采用teleport/Webzip/Flashget/Offline等工具来浏览商城!"
Response.End
End If
Function SafeRequest(ParaName,ParaType)
Dim ParaValue
ParaValue=Request(ParaName)
If ParaType=1 then
If not isNumeric(ParaValue) then
Response.write "<center>参数" & ParaName & "必须为数字型,请正确操作!</center>"
Response.end
End if
Else
ParaValue=replace(ParaValue,"'","''")
End if
SafeRequest=ParaValue
End function
Function FormatSQL(strChar)
if strChar="" then
FormatSQL=""
else
FormatSQL=replace(replace(replace(replace(replace(replace(replace(replace(strChar,"'","’"),"*","×"),"?","?"),"(","("),")",")"),"<","〈"),".","。"),";",";")
end if
End Function
sundxDB="admin/#sundxShopmianfei.mdb"
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&sundxDB&"")
On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查Conn.asp中的数据库指向。" & connstr
Response.End
End If
Dim strTitle,LngDiscount,strUserName,LngUserID,LngGrpID,LngDeposit,rsVip,strUserEmail
LngDiscount = 0
LngUserID = 0
LngDeposit = 0
strUserName = "非注册用户"
strTitle = "非注册用户"
if Request.Cookies("sundxshop")("username")<>"" then
set rsVip=server.CreateObject("adodb.recordset")
rsVip.open "select DV_User.GrpID,DV_User.UserID,DV_User.Score,DV_User.UserEmail,DV_User.Deposit,DV_User.UserName,sundxGRP.GrpName,sundxGRP.Stars from DV_User Inner Join sundxGRP On DV_User.GrpID = sundxGRP.GrpID where username='"&request.Cookies("sundxshop")("username")&"' ",conn,1,1
strTitle = rsVip("GrpName")
LngDiscount = rsVip("Stars")
LngGrpID = Clng(rsVip("GrpID"))
strUserName = rsVip("UserName")
LngUserID = Clng(rsVip("UserID"))
LngScore = Clng(rsVip("Score"))
LngDeposit = rsVip("Deposit")
strUserEmail = rsVip("UserEmail")
rsVip.close
set rsVip=nothing
End If
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="include/css.css" rel="stylesheet" type="text/css"> 展开
有人说是WINDOWS\TEMP文件限权问题,也有说是数据库路径有问题,我搞了半天也没搞好。
下面是CONN.ASP文件源码:
<%
dim conn,connstr,startime,sundxDB,rs,UserAgent
startime=timer()
UserAgent = Trim(Lcase(Request.Servervariables("HTTP_USER_AGENT")))
If InStr(UserAgent,"teleport") > 0 or InStr(UserAgent,"webzip") > 0 or InStr(UserAgent,"flashget")>0 or InStr(UserAgent,"offline")>0 Then
Response.Write "请不要采用teleport/Webzip/Flashget/Offline等工具来浏览商城!"
Response.End
End If
Function SafeRequest(ParaName,ParaType)
Dim ParaValue
ParaValue=Request(ParaName)
If ParaType=1 then
If not isNumeric(ParaValue) then
Response.write "<center>参数" & ParaName & "必须为数字型,请正确操作!</center>"
Response.end
End if
Else
ParaValue=replace(ParaValue,"'","''")
End if
SafeRequest=ParaValue
End function
Function FormatSQL(strChar)
if strChar="" then
FormatSQL=""
else
FormatSQL=replace(replace(replace(replace(replace(replace(replace(replace(strChar,"'","’"),"*","×"),"?","?"),"(","("),")",")"),"<","〈"),".","。"),";",";")
end if
End Function
sundxDB="admin/#sundxShopmianfei.mdb"
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&sundxDB&"")
On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查Conn.asp中的数据库指向。" & connstr
Response.End
End If
Dim strTitle,LngDiscount,strUserName,LngUserID,LngGrpID,LngDeposit,rsVip,strUserEmail
LngDiscount = 0
LngUserID = 0
LngDeposit = 0
strUserName = "非注册用户"
strTitle = "非注册用户"
if Request.Cookies("sundxshop")("username")<>"" then
set rsVip=server.CreateObject("adodb.recordset")
rsVip.open "select DV_User.GrpID,DV_User.UserID,DV_User.Score,DV_User.UserEmail,DV_User.Deposit,DV_User.UserName,sundxGRP.GrpName,sundxGRP.Stars from DV_User Inner Join sundxGRP On DV_User.GrpID = sundxGRP.GrpID where username='"&request.Cookies("sundxshop")("username")&"' ",conn,1,1
strTitle = rsVip("GrpName")
LngDiscount = rsVip("Stars")
LngGrpID = Clng(rsVip("GrpID"))
strUserName = rsVip("UserName")
LngUserID = Clng(rsVip("UserID"))
LngScore = Clng(rsVip("Score"))
LngDeposit = rsVip("Deposit")
strUserEmail = rsVip("UserEmail")
rsVip.close
set rsVip=nothing
End If
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="include/css.css" rel="stylesheet" type="text/css"> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询