问题补充说明:我网上下了一个网站的源码就出现了数据库连接出错,请检查Conn.asp中的数据库指向,我是在一个空间中建立了一个另外的目录用来放网站的,目录名称是007,请问各位大虾要怎么做菜能解决... 我网上下了一个网站的源码 就出现了 数据库连接出错,请检查Conn.asp中的数据库指向 ,我是在一个空间中建立了一个另外的目录用来放网站的,目录名称是 007 ,请问各位大虾要怎么做菜能解决这个问题啊。代码如下:<%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.EndEnd IfFunction SafeRequest(ParaName,ParaType) Dim ParaValue ParaValue=Request(ParaName) If ParaType=1 then If not isNumeric(ParaValue) then Response.write "
参数" & ParaName & "必须为数字型,请正确操作!" Response.end End if Else ParaValue=replace(ParaValue,"'","''") End if SafeRequest=ParaValueEnd functionFunction FormatSQL(strChar)if strChar="" thenFormatSQL=""elseFormatSQL=replace(replace(replace(replace(replace(replace(replace(replace(strChar,"'","’"),"*","×"),"?","?"),"(","("),")",")"),"<","〈"),".","。"),";",";")end ifEnd Function TimesDB="../database/shopdata/#shopdata#.mdb"connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&TimesDB&"")On Error Resume Next Set conn = Server.CreateObject("ADODB.Connection") ***.open connstr If Err Then err.Clear Set Conn = Nothing Response.Write "数据库连接出错,请检查Conn.asp中的数据库指向。"' Response.End End If LngDiscount = 1LngUserID = 0LngDeposit = 0strUserName = "非注册用户"strTitle = "非注册用户"if Request.Cookies("timesshop")("username")<>"" then set rsVip=server.CreateObject("adodb.recordset")***.open "select [User].GrpID,[User].UserID,[User].Score,[User].UserEmail,[User].Deposit,[User].UserName,TimesGrp.GrpName,TimesGrp.Stars from [User] Inner Join TimesGrp On [User].GrpID = TimesGrp.GrpID where username='"&request.Cookies("timesshop")("username")&"' ",conn,1,1strTitle = 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.closeset rsVip=nothing End If%> 展开
展开全部我一般是把数据库链接文件放在一个文件中,其他的检查是否为注册用户,管理员之类的放在其他文件中,另外问一下,你是用的什么数据库
标签:数据库,Conn,sp
版权声明:文章由 神舟问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.shenzhouwen.com/answer/321336.html