`
wsql
  • 浏览: 11755046 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

asp 增删改 拍卖后台

 
阅读更多
<!--#include file="../conn/conn.asp"-->
<%
dim action, title, price, desc, isonsale,insertsql, updatesql, isonsalesql, delsql, recaffected, itemid, editid
action = Trim(request.QueryString("action"))
itemid = Trim(request.QueryString("ID"))
diy=Trim(Request.QueryString("diy"))
editid = Trim(request.Form("eitemid"))
set rs=server.CreateObject("ADODB.Recordset")
title=trim(request.Form("topic"))
price = trim(request.Form("price"))
desc = trim(request.Form("word"))
isonsale = request.Form("isok")
if isonsale = "1" then
isonsale=True
else
isonsale=False
end if
page=Trim(Request.QueryString("page"))
if page="" then
page=0
end if
%>


<!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>项目管理系统 by www.tcshw.com-QQ:459942416</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.tabfont01 {
font-family: "宋体";
font-size: 9px;
color: #555555;
text-decoration: none;
text-align: center;
}
.font051 {font-family: "宋体";
font-size: 12px;
color: #333333;
text-decoration: none;
line-height: 20px;
}
.font201 {font-family: "宋体";
font-size: 12px;
color: #FF0000;
text-decoration: none;
}
.button {
font-family: "宋体";
font-size: 14px;
height: 37px;
}
html { overflow-x: auto; overflow-y: auto; border:0;}
</style>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="62" background="images/nav04.gif">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="21" align="right">■</td>
<td width="538" class="dhfont01">拍卖管理</td>
<td width="144" align="left">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<%
if conn.State = 0 then
conn.Open()
end if
'删除操作
if action = "del" then
delsql = "delete from [pm] where ID="&itemid
on error resume next '错误处理
conn.Execute delsql,recaffected
If Err.Number <> 0 Then
Response.Write (Err.Description& "<br><br>")
Response.Write("This means there is most likely a problem with the" & vbCrLf)
Response.Write("""ConnectionString"" info that you specified.<br>" & vbCrLf)
Response.End
else
response.Write "<script>alert('add success !');</script>"
end if
conn.close
end if


if action="isok" then '下架处理
isonsalesql = "update [pm] set [isonsale]="&isonsale&" where ID="&itemid
on error resume next
conn.Execute isonsalesql,recaffected
If Err.Number <> 0 Then
Response.Write (Err.Description& "<br><br>")
Response.Write("This means there is most likely a problem with the" & vbCrLf)
Response.Write("""ConnectionString"" info that you specified.<br>" & vbCrLf)
Response.End
else
response.Write "<script>alert('add success !');</script>"
end if
conn.close
end if
%>
<table id="subtree1" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<%
if action="add" then '添加或修改, 标志是是否有记录ID
if title<>"" and price<>"" then '如果为空则初始化窗口桌面.
if editid = "" then '添加操作
insertsql = "insert into [pm] ([QQ], [title], [price], [description], [isonsale]) values(' ','"&title&"',"&price&",'"&desc&"',"&isonsale&")"
on error resume next
conn.Execute insertsql,recaffected
If Err.Number <> 0 Then
Response.Write (Err.Description& "<br><br>")
Response.Write("This means there is most likely a problem with the" & vbCrLf)
Response.Write("""ConnectionString"" info that you specified.<br>" & vbCrLf)
Response.End
else
response.Write "<script>alert('add success !');</script>"
Response.End
end if
conn.close
else '修改操作
updatesql = "update [pm] set [title]='"&title&"', [price]="&price&", [description]='"&desc&"', [isonsale]="&isonsale&" where ID="&editid
on error resume next
conn.Execute updatesql,recaffected
If Err.Number <> 0 Then
Response.Write (Err.Description& "<br><br>")
Response.Write("This means there is most likely a problem with the" & vbCrLf)
Response.Write("""ConnectionString"" info that you specified.<br>" & vbCrLf)
Response.End
else
response.Write "<script>alert('update success !');</script>"
Response.End
end if
conn.close
end if
end if

%>

<!--新增记录,窗口初始化-->

<form name="form1" method="post" action="?action=add" onSubmit="javascript:return checkform();">
<input id="eitemid" name="eitemid" type="hidden" value=""><!--这里的input隐藏控件必须放在form中-->
<table width="760" border="0" align="center" cellpadding="0" cellspacing="1" bgColor=#b8d9f6>
<tr>
<td height="40" colspan="2" align="center" bgcolor="#8DC6E0" class="dhfont01"><strong>添加拍卖</strong>
</td>
</tr>
<tr>
<td width="150" height="25" align="right" bgcolor="#E8F1F8">拍卖标题:</td>
<td bgcolor="#F2F7FB">&nbsp;<input name="topic" type="text" id="topic" size="40" maxlength="255" value="" /></td>
<tr>
<td height="25" align="right" bgcolor="#E8F1F8">当前价格:</td>
<td bgcolor="#F2F7FB">&nbsp;<input name="price" type="text" id="price" size="4" maxlength="8" value="" />
元</td>
</tr>
<tr>
<td height="25" align="right" bgcolor="#E8F1F8">拍卖描述:</td>
<td bgcolor="#F2F7FB">&nbsp;<textarea name="word" cols="40" rows="9"></textarea></td>
</tr>
<tr>
<td height="25" align="right" bgcolor="#E8F1F8">是否上架:</td>
<td bgcolor="#F2F7FB">&nbsp;<input name="isok" type="radio" id="isok" value="1" checked="checked" />上架
&nbsp; <input type="radio" name="isok" id="isok" value="0" />下架
</td>
</tr>
<tr>
<td height="45" colspan="2" align="center" bgcolor="#E8F1F8"><input name="button" type="submit" class="dhbutton01" id="button" value="确 定 添 加" />
&nbsp; &nbsp;
<input name="button2" type="reset" class="dhbutton02" id="button2" value="重 新 填 写" /></td>
</tr>
</table>
</form>
<%end if
if action= "edit" then '进行修改操作时,对界面进行初始化
sql="select * from [pm] where ID="&itemid
if conn.State= 0 then
conn.Open()
end if
rs.open sql,conn


%><!--修改记录,窗口初始化-->
<form name="form1" method="post" action="?action=add" onSubmit="javascript:return checkform();">
<input id="eitemid" name="eitemid" type="hidden" value="<%=itemid%>">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="1" bgColor=#b8d9f6>
<tr>
<td height="40" colspan="2" align="center" bgcolor="#8DC6E0" class="dhfont01"><strong>添加拍卖</strong>
</td>
</tr>
<tr>
<td width="150" height="25" align="right" bgcolor="#E8F1F8">拍卖标题:</td>
<td bgcolor="#F2F7FB">&nbsp;<input name="topic" type="text" id="topic" size="40" maxlength="255" value="<%=rs("title")%>" /></td>
<tr>
<td height="25" align="right" bgcolor="#E8F1F8">当前价格:</td>
<td bgcolor="#F2F7FB">&nbsp;<input name="price" type="text" id="price" size="4" maxlength="8" value="<%=rs("price")%>" />
元</td>
</tr>
<tr>
<td height="25" align="right" bgcolor="#E8F1F8">拍卖描述:</td>
<td bgcolor="#F2F7FB">&nbsp;<textarea name="word" cols="40" rows="9"><%=rs("description")%></textarea></td>
</tr>
<tr>
<td height="25" align="right" bgcolor="#E8F1F8">是否上架:</td>
<%if rs("isonsale")=True then%>
<td bgcolor="#F2F7FB">&nbsp;<input name="isok" type="radio" id="isok" value="1" checked="checked" />上架
&nbsp; <input type="radio" name="isok" id="isok" value="0" />下架
</td>
<%else%>
<td bgcolor="#F2F7FB">&nbsp;<input name="isok" type="radio" id="isok" value="1" />上架
&nbsp; <input type="radio" name="isok" id="isok" value="0" checked="checked" />下架
</td>
<%end if%>
</tr>
<tr>
<td height="45" colspan="2" align="center" bgcolor="#E8F1F8"><input name="button" type="submit" class="dhbutton01" id="button" value="确 定 添 加" />
&nbsp; &nbsp;
<input name="button2" type="reset" class="dhbutton02" id="button2" value="重 新 填 写" /></td>
</tr>
</table>
</form>
<!--添加拍卖结束-->
<%
end if
if action="list" or action="isok" or action="del" or action="edit" then
set rs=server.CreateObject("ADODB.Recordset")
sql="select * from [pm]"
if conn.State= 0 then
conn.Open()
end if
rs.open sql,conn
rs.pagesize=15
if rs.bof then
Response.Write("<center>")
Response.Write("<BR><BR>")
Response.Write("没找到相关信息")
Response.Write("<BR><BR>")
Response.Write("</center>")
else
page=cint(page)
if page<1 then
page=1
elseif page>rs.pagecount then
page=rs.pagecount
else
end if
end if
rs.AbsolutePage=page
%>


<!--拍卖列表-->


<TABLE width=800 align="center" cellPadding=1 cellSpacing=1 bgColor=#b8d9f6>
<TBODY>
<TR>
<TD width="15" align="left" bgColor=#8DC6E0 >ID</TD>
<TD width="20" align="left" bgColor=#8DC6E0 ><STRONG>QQ</STRONG> </TD>
<TD width="150" align="left" bgColor=#8DC6E0 ><STRONG>标题</STRONG> </TD>
<TD width="50" align="center" bgColor=#8DC6E0 ><STRONG>拍卖价格</STRONG> </TD>
<TD width="100" align="center" bgColor=#8DC6E0 ><strong>描述</strong></TD>
<TD width="30" align="center" bgColor=#8DC6E0 ><strong>状态</strong></TD>
<TD width="70" align="center" bgColor=#8DC6E0 ><strong>操作</strong></TD>
</TR>
<%
for news=1 to rs.pagesize
IF rs.EOF then EXIT FOR
%>
<TR>
<TD bgColor=#F0F7FB align="center"><%=rs("ID")%></TD>
<TD bgColor=#F0F7FB align="left"><%=rs("QQ")%></TD>
<TD align="center" bgColor=#F0F7FB><STRONG><%=rs("title")%></STRONG> </TD>
<TD bgColor=#F0F7FB align="center"><%=rs("price")%></TD>
<TD bgColor=#F0F7FB align="center"><%=rs("description")%></TD>
<TD bgColor=#F0F7FB align="center"><%=rs("isonsale")%></TD>
<TD bgColor=#F0F7FB align="center"><a href="?action=isok&id=<%=rs("ID")%>">下架</a>&nbsp;&nbsp;
<a href="?action=edit&id=<%=rs("ID")%>">修改</a>&nbsp;<a href="?action=del&id=<%=rs("ID")%>" onClick="return confirm('删除后无法恢复!确认删除?');">&nbsp;删</a>
</TD>
</TR>
<%
rs.MoveNext()
Next
%>
</TBODY>
</TABLE>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="32" align="center" bgcolor="#FFFFFF">第<%= page %>页&nbsp;
<% if page<>1 then %>
<a href="?page=1&classid=<%= classid %>&diy=<%= diy %>">首页</a>
<% else %>
首页
<% end if %>
&nbsp;
<% if page>1 then %>
<a href="?page=<%= page-1 %>&classid=<%= classid %>&diy=<%= diy %>">上一页</a>
<% else %>
上一页
<% end if %>
&nbsp;
<% if page<rs.pagecount then %>
<a href="?page=<%= page+1 %>&classid=<%= classid %>&diy=<%= diy %>">下一页</a>
<% else %>
下一页
<% end if %>
&nbsp;
<% if page<rs.pagecount then %>
<a href="?page=<%=rs.pagecount%>&classid=<%= classid %>&diy=<%= diy %>">末页</a>
<% else %>
末页
<% end if %>
&nbsp;总数<%= rs.recordcount %>条&nbsp; GO
<select name="select2" onChange="MM_jumpMenu('self',this,0)">
<%For m = 1 To rs.PageCount%>
<option value="?page=<%=m%>&classid=<%= classid %>&diy=<%= diy %>"<%if page=m then%>selected<%end if%>><%=m%></option>
<% Next %>
</select>

</td>
</tr>
</table>
<%
else
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<!--拍卖列表结束-->
<script language=javascript>
function checkform()
{
if(document.form1.topic.value=="" )
{
alert("拍卖名不能为空");
form1.sname.focus()
return false;
}
if(document.form1.price.value=="")
{
alert("拍卖价格不能为空");
form1.buynum.focus()
return false;
}
if(document.form1.word.value=="")
{
alert("拍卖描述不能为空");
form1.user1.focus()
return false;
}
}
</script>
</td>
</tr>
</table>
</body>

</html>


效果图:






源码:

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics