当前位置:编程学习 > C#/ASP.NET >>

数据库连接出错,请检查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/#sundxShop#.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中的数据库指向。"'
Response.End
End If

Dim strTitle,LngDiscount,strUserName,LngUserID,LngGrpID,LngDeposit,rsVip,strUserEmail
LngDiscount = 1
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">
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,