在WEB编程中经常会碰到数据的批量删除。我们通常的做法是通过循环来实现数据的批量的删除。但是一个程序模块循环用的太多那么这个程序模块的质量就会下降。因此本文就介绍通过巧用in关键字来实现数据的批量删除。
让我们通过一个例子来讲解IN关键字的数据批量删除
假如我们要删除这个页面的数据:相关代码如下:
managenews.asp <!--#include file="conn.asp"-->
<%'数据库的连接文件我就不多说了%> <html>
<head>
<title>管理新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../index/style.css" type="text/css">
<script>
function del () //用于判断记录有没有选中的函数
{
var flag=true;
var temp="";
var tmp;
if((document.form1.answer.length+"")=="undefined") {tmp=1}else{tmp=document.form1.answer.length}
if (tmp==1){
if (document.form1.answer.checked){
flag=false;
temp=document.form1.answer
让我们通过一个例子来讲解IN关键字的数据批量删除
假如我们要删除这个页面的数据:相关代码如下:
managenews.asp <!--#include file="conn.asp"-->
<%'数据库的连接文件我就不多说了%> <html>
<head>
<title>管理新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../index/style.css" type="text/css">
<script>
function del () //用于判断记录有没有选中的函数
{
var flag=true;
var temp="";
var tmp;
if((document.form1.answer.length+"")=="undefined") {tmp=1}else{tmp=document.form1.answer.length}
if (tmp==1){
if (document.form1.answer.checked){
flag=false;
temp=document.form1.answer