当前位置: 首页 > 图文教程 > 网络编程 > ASP > 网上“店铺”DIY(2)

ASP
Access 2000 数据库 80 万记录通用快速分页类
Microsoft JET Database Engine 错误 ''80004005'' 未指定的错误的完美解决方法
收藏的ASP常用的函数集
asp分页的一个类
ASP开发网页牢记注意事项
ASP下操作Excel技术总结分析
ASP数据岛操作类
ASP经典分页类
asp论坛在线人数统计研究
ASP调用SQL SERVER存储程序
asp输出bmp
ASP连接数据库的全能代码
ASP面向对象编程探讨及比较
web文件管理器的后续开发
一小偷类!!有兴趣的可以看看
利用ASP实现事务处理的方法
大数量查询分页显示 微软的解决办法
如何把ASP编写成DLL
asp实现树型结构
超级ASP大分页_我的类容我做主

ASP 中的 网上“店铺”DIY(2)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 248 ::
收藏到网摘: n/a

  第二部分:实例

项目结构:
该项目主要由几个ASP文件和一个数据库组成:

book.mdb:存放数据库的内容
index.asp:网站主要的文件,大部分的内容均由它来显示
buy.asp:购物蓝的内容
in.asp:供登录使用
registry.asp:使您成为我们的会员
数据库(book.mdb):
第一个表是Book,用于存储关于书目的一些相关的信息,结构如下:

ID
整型
书的序号

Name
字符
书的名字

Author
字符
作者

Brief
字符
简介

Ifcover
整型
是否首页显示

Price
双精度
价格

Publisher
字符
出版社

Cover
字符
封面的图片的路径

Flag
整型
标志


第二个表是info,用于存储会员的信息,结构如下:

Id
字符
会员登录号

Name
字符
会员姓名

Pwd
字符
登录密码

Email
字符
 
Address
字符
地址

Phone
字符
电话

Post
字符
邮编

Sfz
字符
身份证号码


第三个表是class,用于存储书目的类别,其结构如下:

ID
字符
编号

Name
字符
类别


几个ASP文件的内容:
Index.asp
<!--

分三个TD,最主要的中间的一个,大多数操作都是对中间的一个。

-->

<%@ Language=VBScript %>

<script language=javascript>

function openwindow(num){

window.open ("info.asp?key=" + num,"yu",0,0)

}

</script>

<script language=javascript>

function buy(name){

window.open ("buy.asp?name=" + name ,"yu",0,0)

}

</script>

<script language=javascript>

function viewPage(ipage){

document.Page.txtPage.value=ipage

document.Page.submit()

}

</script>

<HTML>

<HEAD>

<title>网上书店</title>

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

</HEAD>

<BODY bgColor=lightcyan>

<P align=center><IMG alt="网上书店"

src="/upload/tech/20091103/20091103102632_9cc138f8dc04cbf16240daa92d8d50e2.jpg""><br>

<TABLE align=center border=0 cellPadding=0 cellSpacing=10
width="100%" style="BORDER-BOTTOM-COLOR: red; BORDER-LEFT-COLOR: red;
BORDER-RIGHT-COLOR: red; BORDER-TOP-COLOR: red">

<tr>

<td colspan=3>

<table border=1 width=100% bgcolor=Khaki cellpadding=0 cellspacing=0>

<tr>

<td bgcolor=MediumSeaGreen ><% =year(date()) & "年" & month(date)
& "月" & day(date) & "日" %></td>

<td bgcolor=MediumSeaGreen ><a href="about.htm">关于我们</a></td>

<td bgcolor=MediumSeaGreen ><a href=buy.asp?name=view>查询购物蓝
</a></td>

<%

if session("UserID")<>"" then

Response.Write "<td bgcolor=MediumSeaGreen> 会员:" & session
("UserName") & "</td>"

else

Response.Write "<td bgcolor=MediumSeaGreen>会员:未登录</td>"

end if

if session("sum")="" then session("sum")=0

Response.Write "<td bgcolor=MediumSeaGreen>购货总金额:" & session
("sum") & "</td>"

%>

</tr>

</table>

</td>

</tr>

<TR>

<TD width="15%" valign=top bordercolor=deeppink bgcolor=beige>

<A href=index.asp?ifcover=1><P align=center>

最新书目</a><br>

畅销书目<br>

<hr color=deeppink>

<P></P>

<p align=center>

图书分类<br>

<table border=1 cellspacing=0 cellpadding=0 width=100%>

<% set rs=server.Cr