注册 登录
编程论坛 ASP技术论坛

怎样使某几个大类显示在同一个页面

zallen 发布于 2008-10-13 18:54, 747 次点击
本人ASP几乎文盲,只懂简单HTML.
麻烦回答详细一些,谢谢帮忙

好比我只想显示大类的
.asp?lx=big&anid=21
.asp?lx=big&anid=22
.asp?lx=big&anid=23
.asp?lx=big&anid=24 不现实所有大类的内容
是不是在下面这个ASP里面改数据呢?


<%'开始分页
Const MaxPerPage=15
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
dim anid
anid=split(request("anid"),"|")
set rs=server.CreateObject("adodb.recordset")
if anid="" then
rs.open "select * from shop_books order by adddate desc",conn,1,1
else
rs.open "select * from shop_books where anclassid="&anid&" order by adddate desc",conn,1,1
end if
if err.number<>0 then
response.write "数据库中无数据"
end if

if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 对不起,暂时还没有任何信息!</p>"
else
totalPut=rs.recordcount

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
showContent
showpage totalput,MaxPerPage,"product.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"product.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"product.asp"
end if
end if
end if

sub showContent
dim i
i=0

%>
5 回复
#2
multiple19022008-10-13 19:21
Select xxx From yyy Where Category=15

==>

Select xxx From yyy Where Category in (0,1,2,3,4,5,6)
#3
zallen2008-10-14 23:06
[bo][un]multiple1902[/un] 在 2008-10-13 19:21 的发言:[/bo]

Select xxx From yyy Where Category=15

==>

Select xxx From yyy Where Category in (0,1,2,3,4,5,6)



那是不是我需要改的语句是:
"select * from shop_books where [bo]anclassid="&anid&" [/bo]order by adddate desc"
我标红的地方是不是要改啊?
具体怎么改麻烦说详细点,非常感谢
#4
zallen2008-10-15 12:38
#5
sunfishy2008-10-15 14:36
如果客户端传过来的anid值是多项的

那么在SQL中就用in.

anclassid in "&anid&"
#6
wxm1984272008-10-15 14:43
回复 3# zallen 的帖子
应该这样吧:"select * from shop_books where anclassid='"&anid&"' order by adddate desc"
1