ASP 网页
设计代码之产品展示界面
1.创建一个 pro1.asp ......................................................................................................................... 2 2.创建产品详细展示界面 proshow.asp ........................................................................................... 5 3.创建连接数据库的文件 conn.asp................................................................................................. 8 4.创建数据库 Data.Mdb................................................................................................................... 9
亲爱的读友们,下面的代码是我平常
工作时会做到的代码,所谓好东西大家一起分享, 希望你们看了能够顺利的做出来哦最初一定要新建一个文件夹, 无论放在哪里都可以, 路径 是虚拟路径。但是一定要吧下面几个创建的文件放在同一个文件夹里面。
1.创建一个 pro1.asp 创建一个
添加以下代码,这里我已经简化成最简化了。所以基本不用再继续删减了。 <
HTML XMLNS="W3.ORG 1999 xhtml?>
<% Bigclassname=Request("Bigclassname") Smallclassname=Request("Smallclassname") set rs=server.createobject("adodb.recordset") if Request("Bigclassname")="" then sql="select top 700 * from product order by product_ID" end if if Request("Bigclassname")<>"" and request("smallclassanme")=""then sql="select * from product where bigclassname='"&;Bigclassname&;"' order by product_ID " end if if Request("Bigclassname")<>"" and request("smallclassname")<>"" then sql="select * from product where bigclassname='"&;Bigclassname&;"' and Smallclassname ='"&;smallclassname&;"'order by product_ID desc" end if rs.open sql,conn,1,1 if rs.eof or rs.bof then response.write "暂时没有产品记录!" end if if request("page")="" then page=1 else page=cint(request("page")) end if rs.pagesize=12 rs.absolutepage=page url="Pro1.asp?BigClassName="&;BigClassName&;"&;SmallClassName="&;SmallClassName&;"&; page=" %> <% call ShowClassGuide() %> | <% call ShowArticleTotal() %> &;nbsp;&;nbsp;&;nbsp;&;nbsp;&;nbsp; | <%for i=1 to rs.pagesize%> | <% if i mod 4=0 then response.write(" ") end if rs.movenext if rs.eof then exit for next %> <%if page>1 then%> "> 首 页 &;nbsp;&;nbsp; 上一页&;nbsp;&;nbsp; <%else response.Write("首页 上一页 ") end if%> <%if page 下一页&;nbsp;&;nbsp;尾页 <%else response.Write("下一页 尾页") end if%> &;nbsp;当前第<%=page%>/<%=rs.pagecount%>页
|
<% sub ShowClassGuide() response.write "&;nbsp;
产 品 &;nbsp;&;gt;&;gt;" if BigClassName="" and SmallClassName="" then response.write "&;nbsp;所有产品" else if BigClassName<>"" then response.write "&;nbsp;
" &; BigClassName &; "&;nbsp;&;gt;&;gt;&;nbsp;" if SmallClassName<>"" then response.write "
" &; SmallClassName &; "" else response.write "所有小类" end if end if end if end sub %> <% sub ShowArticleTotal() dim sqlTotal dim rsTotal sqlTotal="select Count(*) from Product where Passed=True " if BigClassName<>"" then
sqlTotal=
sqlTotal &; " and BigClassName='" &; BigClassName &; "' " if SmallClassName<>"" then sqlTotal=sqlTotal &; " and SmallClassName='" &; SmallClassName &; "' " end if else if SpecialName<>"" then sqlTotal=sqlTotal &; " and SpecialName='" &; SpecialName &; "' " end if end if Set rsTotal= Server.CreateObject("ADODB.Recordset") rsTotal.open sqlTotal,conn,1,1 if rsTotal.eof and rsTotal.bof then totalPut=0 response.write "共有 0 个产品" else totalPut=rsTotal(0) response.Write "共有 " &; totalPut &; " 个产品" end if rsTotal.close set rsTotal=nothing end sub %>
2.创建产品详细展示界面 proshow.asp 创建产品详细展示界面
在 proshow.asp 界面添加如下代码
<% ShowSmallClassType=ShowSmallClassType_Article dim id id=trim(request("id")) if id="" then response.Redirect("Product.asp") end if sql="select * from Product where id=" &; id &; "" Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3 if rs.bof and rs.eof then response.write"" else rs("Hits")=rs("Hits")+1 rs.update if rs("hits")>=HitsOfHot then rs("Hot")=True rs.update end if BigClassName=rs("BigClassName") SmallClassName=rs("SmallClassName") %>
<% response.write "&;nbsp;" &; rs("BigClassName") &; "&;nbsp;&;gt;&;gt;&;nbsp;" if rs("SmallClassName") &; ""<>"" then response.write "" &; rs("SmallClassName") &; "&;nbsp;&;gt;&;gt;&;nbsp;" end if response.write rs("Title") %> |
<td height="1" colspan="3" align="
-
相关文章
-
最新文件
关于网学 |
万能工具 |
在线交流 |
会员中心 |
查询论文 |
招聘说明 |
精品资源 |
专题论文 |
会员中心 |
联系方式 |
下载目录
论文目录
Copyright 2005-2018 www.myeducs.cn All Rights Reserved 版权所有·网学网 提供大量原创论文 参考论文 论文资料 源代码 管理及投稿 E_mail:3710167@qq.com
郑重声明: 本网站论文均来自互联网,由本站会员上传或下载,仅供个人交流、学习、参考之用,版权归原作者所有
请下载完后24小时之内删除,任何人不得大幅抄录、在期刊上发表或作为商业之用。如涉及版权纠纷,本网站不承担任何法律及连带责任。