ASP删除多条记录
作者:cmscn 日期:2009-08-13
<script language="javascript">
function del()
{
if (confirm ("确定要删除吗?"))
{window.location.href="delete.asp"}
else return false;
}
function CheckAll(form){for (var i=0;i<form.elements.length;i++){var e = form.elements[i];if (e.name != 'chkall')e.checked = form.chkall.checked;}}
</script>
</head>
<body>
<form action="delete1.asp" method="post" name="form" onsubmit="javascript:return del()">
<table width="32%" border="0" align="center" cellpadding="0" cellspacing="0">
<%do while not rs.eof%>
<tr>
<td width="50%"><%=rs("ming")%></td>
<td width="50%"><input name="check" type="checkbox" id="check" value="<%=(rs.Fields.Item("id").Value)%>" /></td>
</tr>
<%rs.movenext
loop%>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="提交" />
<input type="checkbox" name="chkall" onclick="CheckAll(this.form)" />
全选</td>
</tr>
</table>
</form>
<!--#include file="conn.asp"-->
<%
if request("check")="" then
response.write"<script>alert('请选择删除项目!');location.href='delete.asp';</script>"
else
if(request("check") <> "") then
Command1__ddd = request("check")
set Command2 = Server.CreateObject("ADODB.Command")
Command2.ActiveConnection =conn
Command2.CommandText = "delete from biao1 where id in ("& Replace(Command1__ddd, "'", "''") &")"
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()
response.Redirect("delete.asp")
end if
end if
%>
评论: 0 | 引用: 0 | 查看次数: 466
发表评论