我还是不太清楚,没实验成功过,所以把代码弄出来!
<table width="719" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="228" height="22"> </td>
<td width="74" align="center" valign="middle">id:</td>
<td width="344" valign="middle"> 姓 名: </td>
<td width="68" align="center" ><input type='submit' class=buttonface value='删 除'></td>
</tr><%do while not rs.eof%>
<tr>
<td height="21"> </td>
<td align="center" valign="middle"><%=rs("id")%> </td>
<td valign="middle"> <a href="dao2.asp?id=<%=rs("id")%>"><%=rs("name")%></a></td>
<td valign="top"><form id="form1" name="form1" method="post" action="">
<label>
<input type="checkbox" name="selAnnounce" value="<%=cstr(rs("id"))%> "/>
</label>
</form> </td>
<%
rs.movenext
loop
%>
然后呢
有一个过程
<%
sub deleteannounce(id)
dim rs,sql
response.write "<center><font color=red>"
set rs=server.createobject("adodb.recordset")
sql="delete from img where id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
else
response.write "删除成功!<br>"
end if
response.write "</font></center>"
End sub
%>
调用过程的是
<%
dim idlist
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
dim sql
dim rs
%>