本人写的ASP程序源代码
数据连接部分
<%
dim db,conn,constr
db="diaocha.mdb"
set conn=server.createobject("adodb.connection")
constr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open constr
%>
添加内容部分
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<form id="form1" name="form1" method="get" action="save.asp">
<label> 用户ID
<input type="text" name="useid" />
</label>
<label>相册名
<input type="text" name="photo" />
</label>
<label><br />
相片编号
<input type="text" name="no" />
</label>
<p>
<label>艺术价值
<select name="yishu">
<option value="分">5</option>
<option value="分">6</option>
<option value="分">7</option>
<option value="分">8</option>
<option value="分">9</option>
<option value="分">10</option>
</select>
相片品质 </label>
<label>
<select name="xiangpian">
<option value="分">5</option>
<option value="分">6</option>
<option value="分">7</option>
<option value="分">8</option>
<option value="分">9</option>
<option value="分">10</option>
</select>
收藏价值 </label>
<label>
<select name="shouchang">
<option value="分">5</option>
<option value="分">6</option>
<option value="分">7</option>
<option value="分">8</option>
<option value="分">9</option>
<option value="分">10</option>
</select>
</label>
<label>
公益价值
<select name="gongyi">
<option value="分">5</option>
<option value="分">6</option>
<option value="分">7</option>
<option value="分">8</option>
<option value="分">9</option>
<option value="分">10</option>
</select>
</label>
稀有性
<select name="xiyou">
<option value="分">5</option>
<option value="分">6</option>
<option value="分">7</option>
<option value="分">8</option>
<option value="分">9</option>
<option value="分">10</option>
</select>
</p>
<p>
<label>评价理由
<textarea name="liyou" cols="100" rows="3"></textarea>
</label>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
<label>
<input type="reset" name="Submit2" value="取消" />
</label>
</p>
</form>
存入数据库部分
<%dim db,conn,constr
db="diaocha.mdb"
set conn=server.createobject("adodb.connection")
constr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open constr
useid=Replace(Request.Form("photo"),"'","''")
photo=Replace(Request.Form("name"),"'","''")
no=Replace(Request.Form("no"),"'","''")
shouchang=Replace(Request.Form("shouchang"),"'","''")
yishu=Replace(Request.Form("yishu"),"'","''")
xiangpian=Replace(Request.Form("xiangpian"),"'","''")
gongyi=Replace(Request.Form("gongyi"),"'","''")
xiyou=Replace(Request.Form("xiyou"),"'","''")
liyou=Replace(Request.Form("liyou"),"'","''")
%>
<%if useid="" or photo="" or no="" then%>
请<a href="say.asp">后退</a>填写完整资料,你才能发表评论!
<%else%>
<%set savebbs=conn.execute("insert into diaocha(useid,photo,no,xiyou,shouchang,yishu,liyou,xiangpian,gongyi)values('"&useid&"','"&photo&"','"&no&"''"&xiyou&"','"&shouchang&"','"&yishu&"','"&liyou&"','"&xiangpian&"','"&gongyi&"')")%>
发表成功!<a href="index.asp">查看评论</a>
<%end if
set savebbs=nothing
%>
显示部分
<!--#include file="conn.asp"-->
<%id=request.querystring("id")%>
<%set show=conn.execute("select*from diaocha where id="&id&"")%>
<a href="index.asp">
<b>回到首页</b></a><br><b><a href="say.asp">发表评论</a></b><br><hr size="1">
<table width="432" border="1">
<tr>
<td width="136"><strong>用户名:</strong><%=show("useid")%></td>
<td width="126"><strong>相册名:</strong><%=show("photo")%></td>
<td width="148"><strong>相片编号:</strong><%=show("no")%></td>
</tr>
<tr>
<td><strong>艺术价值:</strong><%=show("yishu")%></td>
<td><strong>相片品质:</strong><%=show("xiangpian")%></td>
<td><strong>收藏价值:</strong><%=show("shouchang")%></td>
</tr>
<tr>
<td colspan="2"><strong>公益价值:</strong><%=show("gongyi")%></td>
<td><strong>稀有性:</strong><%=("xiyou")%></td>
</tr>
<tr>
<td colspan="3"><strong>评价理由:</strong><%=("liyou")%></td>
</tr>
</table>
首页可调用部分
<!--#include file="conn.asp"-->
<b><a href="say.asp">发表评论</a></b><br><br>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="26">
<tr>
<td width="17%"><b>用户名</b></td>
<td width="83%"><b>相册名</b></td>
</tr>
</table>
</center>
</div><hr size="1">
<%i=1
set showbbs=conn.execute("select*from diaocha order by id desc")
do while not showbbs.eof
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="20">
<tr>
<td width="17%"><%=showbbs("useid")%> </td>
<td width="83%">
<a href="show.asp?id=<%=showbbs("id")%>"><%=showbbs("photo")%></a></td>
</tr>
</table>
</center>
</div><hr size="1">
<%i=i+1
if i>50 then exit do
showbbs.movenext
Loop
showbbs.Close
set showbbs=nothing
%>