关于ASP的固顶功能。

来源:百度知道 编辑:UC知道 时间:2024/06/06 04:16:24
请问如何在着加上“固顶”功能? 数据库的“打勾”值是ontop,后台的改好了,前台显示请问加在哪?谢谢
'=================================================
'过程名:ShowProduct
'=================================================
sub ShowProduct(TitleLen)
if TitleLen<0 or TitleLen>200 then
TitleLen=50
end if
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
sqlProduct="select top " & MaxPerPage
else
sqlProduct="select "
end if

sqlProduct=sqlProduct & " ID,Product_Id,BigClassName,SmallClassName,IncludePic,Title,Price,Spec,Unit,Memo,DefaultPicUrl,UpdateTime,Hits from Product where Passed=True "

if BigClassName<&

看到代码头晕哦。

固顶的实现一般是需要2步:
1、找到固定的帖子如用:select top 5 * from 表 where ontop=1
ontop=1是固顶的帖子的意思。
2、程序分页与固顶帖子的结合,如果你固顶的帖子数量不限的话需要从第一步中取出来有多少个固顶的帖子,如上是5个,你的分页有20,那么你的第一页剩下的记录数只能取15个。
select * from 表 where ontop<>1
....