📄 productpage.asp
字号:
<!--#include file="Function.asp"-->
<%
Private sTypeID
Private sKeyWord
Private Sub ShowTypeLink()
Call OpenData()
Dim objRec
Dim strSQL
strSQL = "Select * from ProductType"
Set objRec = Conn.Execute(strSQL)
With ObjRec
Do While Not .Eof
Response.Write "<a href=?TypeID=" & .Fields(0).Value & ">" & .Fields(1).Value & "</a> "
.MoveNext
Loop
End With
Set objRec = Nothing
Call CloseDataBase()
End Sub
Private Sub ShowPage(strPageID,ShowNV,PageSizeNum,TypeID,pWord)
Dim strSQL
Dim objRs
Dim PageNum
Page = strPageID
sTypeID = cstr(TypeID)
sKeyWord = FilterSQL(pWord)
If Len(sKeyWord)>0 Then
strWhere = " Where ProductName like '%" & sKeyWord & "%'"
End If
If Len(strWhere)=0 Then
If Rate > 0 Then
strWhere = strWhere & " Where Rate=" & Rate
End If
End If
If TypeID = "0" Then
strSQL="SELECT pID, ProductName, ProductType,ProductPic,Web_Url FROM ProductList " & strWhere & " order By pID desc "
Elseif TypeID="" Then
strSQL="SELECT pID, ProductName, ProductType,ProductPic,Web_Url FROM ProductList " & strWhere & " order by pID desc "
Else
strWhere = " And ProductName like '%" & sKeyWord & "%'"
strSQL="SELECT pID, ProductName, ProductType,ProductPic,Web_Url FROM ProductList where ProductType = " & TypeID & strWhere & " order by pID desc "
End if
Set objRs=Server.CreateObject("ADODB.RecordSet")
objRs.Open strSQL,Conn,1,1
'Response.Write "<table border=""0"" cellpadding=""0"" width=""100%"" cellspacing=""2"">" & vbcrlf
With objRs
If .eof and .bof then
page = 1
pagecountNum = 1
CountNum=0
Response.Write "<tr><td colspan=""6"" align=""center""><font color=""red"">没有找到您需要的信息!</font></td></tr>"
Else
CountNum = .RecordCount
.pagesize = PageSizeNum'设定每页显示的记录数
if page<1 then'设定页数的值
page=1
elseif page>.pagecount then
page=.pagecount
else
page=page
End if
pagecountNum=.Pagecount
.absolutepage = page'设定当前活动页
recordsetcount=1
Dim icount
Response.Write "<tr><td colspan=""6"" height=""10"">" & vbcrlf
Response.Write "</td></tr>" & vbcrlf
Response.Write "<tr><td>" & vbcrlf
Do while not .eof and recordsetcount<=.pagesize
if icount mod 3 = 0 Then Response.Write "</td></tr><tr><td>"
OutStr "<table width=""162"" height=""136"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
OutStr "<tr>"
OutStr "<td height=""106"" colspan=""2""><table width=""100%"" height=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
OutStr "<tr>"
OutStr "<td background=""images/product.gif"" align=""center""><a href=Redirect.asp?pid=" & .Fields("pID").Value & " title=ProductName:" & .Fields(1).Value & " target=""_blank""><img width=""150"" height=""100"" src=UpLoadImg/" & .Fields(3).value & " border=""0""></a></td>"
OutStr "</tr>"
OutStr "</table>"
OutStr "</td>"
OutStr "</tr>"
OutStr "<tr>"
OutStr "<td width=""5"" height=""30"" align=""left""></td>"
OutStr "<td width=""150""><div align=""center""><img src=""images/dian.gif"" width=""10"" height=""9""><font color=white> " & .Fields(1).Value & "</font></div></td>"
OutStr "</tr>"
OutStr "</table>"
.MoveNext
Response.Write "</td><td>"
icount = icount+1
recordsetcount=recordsetcount+1
Loop
Response.Write "</td></tr>" & vbcrlf
End if
objRs.Close
End With
If ShowNV Then
Response.Write "<tr><td colspan=""4"">" & vbcrlf
ShowPageNav
Response.Write "</td></tr>" & vbcrlf
End if
Set objRs=Nothing
End Sub
'======================推荐企业===========================
Private Sub Show_Tujian()
Dim objRec
Call OpenData
Set objRec = Conn.Execute("Select pID, ProductName, ProductType,ProductPic,Web_Url From ProductList Where IsGood=True Order By pID Desc")
With objRec
If .Eof and .Bof then
Else
Response.Write "<table width=""90%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0""><tr>"
OutStr "<td height=10></td></tr><tr>"
Do While Not .Eof
OutStr "<td><table width=""162"" height=""136"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0""><tr><td height=""106"" colspan=""2""><table width=""100%"" height=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0""><tr>" & _
"<td background=""images/product.gif"" align=""center""><a href=""" & .Fields("Web_URL").Value & """ title=ProductName:" & .Fields(1).Value & " target=""_blank""><img width=""150"" height=""100"" src=uploadimg/" & .Fields(3).value & " border=""0""></a></td>" & _
"</tr>" & _
"</table>" & _
"</td>" & _
"</tr>" & _
"<tr>" & _
"<td width=""5"" height=""30"" align=""left""></td>" & _
"<td width=""150""><div align=""center""><img src=""images/dian.gif"" width=""10"" height=""9""> " & .Fields(1).Value & "</div></td>" & _
"</tr>" & _
"</table>" & _
"</td>" & _
"<td width=""10""> </td>" & _
.MoveNext
Loop
End If
.Close
Response.Write "</tr></table>"
End With
Set objRec = Nothing
End Sub
'======================推荐企业结束===========================
'===================管理分页开始===============================
Private Sub ShowManagePage(strPageID,PageSizeNum,p_typeid,str_Key)
Dim strSQL
Dim objRs
Dim PageNum
Page = strPageID
sKeyWord = str_Key
If Len(str_Key)>0 Then
strSQL="SELECT pID, ProductName, ProductType,ProductPic,InputDate FROM ProductList Where ProductName like '%" & FilterSQL(str_Key) & "%' order by pID desc"
Else
strSQL="SELECT pID, ProductName, ProductType,ProductPic,InputDate FROM ProductList order by pID desc"
End If
Set objRs=Server.CreateObject("ADODB.RecordSet")
Call OpenDataBase(1)'打開数据库
objRs.Open strSQL,Conn,1,1
With objRs
If .eof and .bof then
Response.Write "<tr bgcolor='#f3f3f3'><td colspan=""4"">"
Response.Write "暂无信息"
Response.Write "</td>"
Else
CountNum = .RecordCount
.pagesize = PageSizeNum'设定每页显示的记录数
if page<1 then'设定页数的值
page = 1
elseif page>.pagecount then
page = .pagecount
else
page = page
End if
pagecountNum=.Pagecount
.absolutepage = page'设定当前活动页
recordsetcount=1
Dim iCount
iCount = (page-1) * PageSizeNum
Do while not .eof and recordsetcount<=.pagesize
iCount = iCount + 1
Response.Write "<tr bgcolor='#f3f3f3'><td>"
Response.Write "<li>" & iCount & "." & .Fields(1).Value
Response.Write "<td align=center>" & .Fields(4).value & "</td>"
Response.Write "<td>"
Response.Write "<a href=Product.asp?id=" & .Fields(0).value & ">修改</a>  "
Response.Write "<a href='javascript:deleted(""" & .Fields(3).Value & """," & .Fields(0).value & ")'>删除</a>"
Response.Write "</td></tr>"
.MoveNext
recordsetcount=recordsetcount+1
Loop
End if
str_Key = "&KeyWord=" & str_Key
.Close
Call ShowPageNav
End With
Set objRs=Nothing
End Sub
'--------------管理分页结束========================'
Private Sub ShowFirstPage()
Dim strSQL
Dim objRs
Dim PageNum
Page = strPageID
sTypeID = cstr(TypeID)
strSQL="SELECT top 6 pID, ProductName, ProductType,ProductPic FROM ProductList Where ProductType = 1 And IsGood = 0 order by snumber desc, pID desc "
'Response.Write strSQL
Set objRs=Server.CreateObject("ADODB.RecordSet")
'Call OpenDataBase(0)'打開数据库
objRs.Open strSQL,Conn,1,1
Response.Write "<table border=""0"" cellpadding=""0"" width=""100%"" cellspacing=""2"">" & vbcrlf
With objRs
If .eof and .bof then
page = 1
pagecountNum = 1
CountNum=0
Response.Write "<font color='red'>暂无产品信息</font>"
Else
recordsetcount=1
Dim icount
Response.Write "<tr><td>" & vbcrlf
Do while not .eof and recordsetcount<=.pagesize
if icount mod 3 = 0 Then Response.Write "</td></tr><tr><td>"
OutStr "<table width=""162"" height=""136"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
OutStr "<tr>"
OutStr "<td height=""106"" colspan=""2""><table width=""100%"" height=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
OutStr "<tr>"
OutStr "<td background=""images/product.gif"" align=""center""><a href=products.asp?pID=" & .Fields(0).Value & " title=ProductName:" & .Fields(1).Value & "><img width=""150"" height=""100"" src=/" & .Fields(3).value & " border=""0""></a></td>"
OutStr "</tr>"
OutStr "</table>"
OutStr "</td>"
OutStr "</tr>"
OutStr "<tr>"
OutStr "<td width=""10"" height=""30""><div align=""right""><img src=""images/dian.gif"" width=""10"" height=""9""></div></td>"
OutStr "<td width=""130""><div align=""center"">" & .Fields(1).Value & "</div></td>"
OutStr "</tr>"
OutStr "</table>"
.MoveNext
Response.Write "</td><td>"
icount = icount+1
recordsetcount=recordsetcount+1
Loop
Response.Write "</td></tr>" & vbcrlf
End if
Response.Write "</table>"
objRs.Close
End With
'
Set objRs=Nothing
End Sub
Private Sub OutStr(Byval strValue)
Response.Write strValue & vbcrlf
End Sub
'Private Const PageSizeNum = 25
'后台新闻管理分页
Private Function GetTitle(strValue,TitleSize)
GetTitle=gotTopic(XCHTMLEncode(strValue),TitleSize)
End function
Private Sub ShowPageNav()
%>
<table border="0" cellpadding="0" style="border-collapse: collapse" width="98%">
<tr>
<td width="10"></td>
<td height="30">
<font color="#FFFFFF">共找到</font> <font color="red"><%=CountNum%></font> <font color="#FFFFFF">个案例 共 </font><font color="red"><%=pagecountNum%></font> <font color="#FFFFFF">页<!--'分页显示设置-->
<%if page>1 then%>
<a href="?page=1&TypeID=<%=sTypeID%>&KeyWord=<%=sKeyWord%>&Rate=<%=Rate%>">首页</a>
<a href="?page=<%=page-1%>&TypeID=<%=sTypeID%>&KeyWord=<%=sKeyWord%>&Rate=<%=Rate%>">上一页</font></a>
<%else%>
首页
上一页
<%end if%>
<%if page<pagecountNum then%>
<a href="?page=<%=page+1%>&TypeID=<%=sTypeID%>&KeyWord=<%=sKeyWord%>&Rate=<%=Rate%>">下一页</a>
<a href="?page=<%=pagecountNum%>&TypeID=<%=sTypeID%>&KeyWord=<%=sKeyWord%>&Rate=<%=Rate%>">尾页</a>
<%else%>
<font color="#FFFFFF">下一页
尾页</font>
<%end if%>
<font color="#FFFFFF">页次</font>:<font color="red"><%=page%>/<%=pagecountNum%></font>
</td>
</tr>
</table>
<%
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -