www.gusucode.com > asp+SQLServer网上书店系统设计(源代码+论文) > asp+SQLServer网上书店系统设计(源代码+论文)\网上书店asp+SQLServer\网上书店\admin\add_news1.asp
<%@ language="vbscript"%> <%response.Expires = 0%> <!--#include file="conn.asp"--> <% if session("admin")="" then Response.redirect "backlogin.asp?msg=对不起你还没有登录,请返回登录!" end if %> <% set rs3=server.createobject("adodb.recordset") sqltext="select * from news where title='" & request.form("title") & "'" rs3.open sqltext,cn,1,1 '查找数据库,检查商品是否已经存在 if rs3.eof then set rs1=server.createobject("adodb.recordset") sqltext="select * from news" rs1.open sqltext,cn,1,1 for i=1 to rs1.recordcount-1 rs1.movenext next set rs=server.createobject("adodb.recordset") sqltext="select * from news" rs.open sqltext,cn,3,3 '添加一个商品到数据库 rs.addnew rs("ID")=rs1("ID")+1 rs("title")=request.form("title") rs("content")=request.form("content") rs("manager")=session("admin") rs("news_date")=now() rs.update rs.close rs1.close %> <% set rs2=server.createobject("adodb.recordset") sqltext2="select * from news where title='" & request.form("title") & "'" rs2.open sqltext2,cn,1,1 %> <html> <head> <title>新闻添加成功</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <STYLE type=text/css>.main { FONT-SIZE: 12px } .main1 { FONT-SIZE: 14px } .main2 { FONT-SIZE: 16px } .main3 { FONT-SIZE: 7px } .main4 { FONT-SIZE: 10px } A:link { COLOR: #ffffff; TEXT-DECORATION: none } A:visited { COLOR: #ffffff; TEXT-DECORATION: none } A:active { COLOR: #ff0000; TEXT-DECORATION: none } A:hover { COLOR: #aa0000; TEXT-DECORATION: underline } </STYLE> </head> <body text="#000000" bgcolor="#e6e4f1"> <p align="center"><br> <br> </p> <div align="center"> <center> <TABLE cellSpacing=1 cellPadding=4 width=429 bgColor=#000000 height="144"> <TBODY> <TR vAlign=top bgColor=#8CAAE7> <TD class=main1 colSpan=2 width="415" height="10"></TD> </TR> <TR vAlign=top bgColor=#BECFF1> <TD class=main1 colSpan=2 width="415" height="32"><font color="#FF0000">新闻添加成功--</font></TD></TR> <tr> <TD class=main1 width=102 bgColor=#BECFF1 height=25 align="right"><SPAN class=main1>主题:</SPAN></TD> <TD class=main1 width=301 height=25 bgcolor="#BECFF1"><%=rs2("title")%></TD> </tr> <tr> <TD class=main1 width=102 bgColor=#BECFF1 height=25 align="right"><SPAN class=main1>发表人:</SPAN></TD> <TD class=main1 width=301 height=25 bgcolor="#BECFF1"><%=rs2("manager")%></TD> </tr> <tr> <TD class=main1 width=102 bgColor=#BECFF1 height=25 align="right"><SPAN class=main1>内容:</SPAN></TD> <TD class=main1 width=301 height=25 bgcolor="#BECFF1"><%=rs2("content")%></TD> </tr> <TR vAlign=top bgColor=#BECFF1> <TD class=main1 colSpan=2 width="415" height="15"></TD></TR> <TR bgColor=#BECFF1> <TD class=main1 colSpan=2 width="415" height="27"> <p align="center"><input type="button" value="返回" name="B4" onclick="javascript:window.history.go(-2)"> <INPUT type="button" class=main value='添加下一条' name=Submit2 onclick="window.location.href='add_news.asp';"> </TD></TR> <TR bgColor=#8CAAE7> <TD class=main1 colSpan=2 width="415" height="4"></TD> </TR></TBODY></TABLE> </center> </div> </body> </html> <% else Response.Redirect "messagebox.asp?msg=此主题已存在了!请选用其它主题!" response.end rs3.close end if rs2.close cn.close %>