巧用in关键字实现数据的批量删除(3) </td> <td align=left><%If Len(rs("title"))<=30 Then%><%=rs("title")%><%else%> <%=(Left(rs("title"),30))%>...<%end if %></td><td align=left><%=rs("addtime")%></td><td align=center><a href="editnews.asp?id=<%=rs("id")%>">编 辑</a></td> </tr> </tbody> <% rs.movenext loop %>
<tr> <td colspan="7" align="center"><input type="checkbox" name="chkall" value="on" onclick="checkall(this)" ID="Checkbox2">选中所有的显示新闻 <input type="button" name="btnDelete" value="删除" style='font-family: 宋体; font-size: 9pt;' onclick="del()" ID="Button1"></td></tr> </table></form> </td> </tr> <%end if%> </table> <% set rs=nothing conn.close set conn=nothing %></body></html>delnews.asp文件<!--#include file="conn.asp"--><% arrdel=Request("id")'Response.Write arrdelsql="delete from news where id in ("&arrdel&")"'Response.Write sqlconn.Execute sqlset conn=nothingresponse.write"<SCRIPT language=JavaScript>alert('删除成功!');"response.write"javascript:history.go(-1)</SCRIPT>"response.end%>
呵呵,上面的代码比较简单我也就不多说了。大家可以试试看是否达到我们的预期结果呢?好了,本文只是作者在做WEB开发的过程中积累的一点经验。希望能给你们带来一点帮助。