weborder.asp

来自「BJXSHOP购物管理系统是一个功能完善、展示信息丰富的电子商店销售平台;针对企」· ASP 代码 · 共 100 行

ASP
100
字号
<!--#include file="connection.asp"-->
<%dim action,shu,heng
'///使用此调用程序首先认真看清以下说明:
'///action=gonggao 显视网站公告,action=news 显视新闻,action=tushu 显视普通图书
'///action=guanzhu 显视关注排行,action=xiaoshou 显视销售排行,action=tuijian 显视被推荐图书 
'///action=dazhe 显视6折以下图书 
'///变量"shu"均是显视的数目,比如要显视5条新闻 action=news&shu=5
'///变量"heng"均是显视标题文字的个数,比如要显视5条新闻,每标题显视20个字 action=news&shu=5&heng=20  
'///当变量"heng"="0"时,图书标题将完全显视
'///此调用文件必须在书让根目录。
action=request.QueryString("action")
shu=int(request.QueryString("shu"))
heng=int(request.QueryString("heng"))
set rs=server.CreateObject("adodb.recordset")
select case action
case "gonggao"
rs.Open "select gonggao from shop_config",conn,1,1
response.Write "document.write ('"&trim(rs("gonggao"))&"');"

case "news"			'//新闻
rs.Open "select top "&shu&" * from shop_news order by adddate desc",conn,1,1 
if rs.EOF and rs.BOF then 
response.Write "document.write ('目前还没有添加新闻!');"
else
do while not rs.EOF
if heng=0 then
response.Write "document.write ('·<a href=news.asp?id="&rs("newsid")&" target=_blank>"&trim(rs("newsname"))&"</a> ("&year(rs("adddate"))&"年"&month(rs("adddate"))&"月"&day(rs("adddate"))&"日)<br> ');"
else
response.Write "document.write ('·<a href=news.asp?id="&rs("newsid")&" target=_blank>"&left(trim(rs("newsname")),heng)&"...</a> ("&year(rs("adddate"))&"年"&month(rs("adddate"))&"月"&day(rs("adddate"))&"日)<br> ');"
end if
rs.MoveNext
loop
end if

case "tushu","tuijian","dazhe"		'//新到图书/推荐图书
if action="tushu" then
rs.Open "select top "&shu&" bookname,bookid,dazhe from shop_books where queshu=0 order by bookdateorder desc",conn,1,1
end if
if action="tuijian" then
rs.Open "select top "&shu&" bookname,bookid,dazhe from shop_books where queshu=0 and bestbook=1 order by bookdateorder desc",conn,1,1
end if
if action="dazhe" then
rs.Open "select top "&shu&" bookname,bookid,dazhe from shop_books where queshu=0 and dazhe<0.6 order by bookdateorder desc",conn,1,1
end if
if rs.EOF and rs.BOF then
response.Write "document.write ('目前数据库中还未有图书!');"
else
do while not rs.EOF
if heng="0" then
response.Write "document.write ('·<a href=book.asp?id="&rs("bookid")&" target=_blank>"&trim(rs("bookname"))&"</a> &nbsp;<font color=#FF6600>"&formatnumber(rs("dazhe")*10,1)&"折</font><br> ');"
else
response.Write "document.write ('·<a href=book.asp?id="&rs("bookid")&" target=_blank>');"
'//截取字节
if len(trim(rs("bookname")))>shu then
response.Write "document.write ('"&left(trim(rs("bookname")),heng)&"...');"
else
response.Write "document.write ('"&trim(rs("bookname"))&"');"
end if

response.Write "document.write ('</a> &nbsp;<font color=#FF6600>"&formatnumber(rs("dazhe")*10,1)&"折</font><br> ');"
end if
rs.MoveNext
loop
end if

case "guanzhu","xiaoshou"		'//图书关注排行/图书销售排行
if action="guanzhu" then
rs.Open "select top "&shu&" bookid,bookname from shop_books where queshu=0 order by liulancount desc",conn,1,1
end if
if action="xiaoshou" then
rs.Open "select top "&shu&" bookid,bookname from shop_books where queshu=0 order by chengjiaocount desc",conn,1,1
end if
if rs.EOF and rs.BOF then
response.Write "document.write ('目前数据库中还未有任何图书!');"
else
do while not rs.EOF
if heng="0" then
response.Write "document.write ('·<a href=book.asp?id="&rs("bookid")&" target=_blank>"&trim(rs("bookname"))&"</a><br> ');"
else
response.Write "document.write ('·<a href=book.asp?id="&rs("bookid")&" target=_blank>');"
'//截取字节
if len(trim(rs("bookname")))>shu then
response.Write "document.write ('"&left(trim(rs("bookname")),heng)&"...');"
else
response.Write "document.write ('"&trim(rs("bookname"))&"');"
end if

response.Write "document.write ('</a><br> ');"
end if
rs.MoveNext
loop
end if

end select
rs.close
set rs=nothing
%>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?