批量删除代码如何用
最好写出较详细的代码
''批量删除代码
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<script language="javascript">
function SelectAllCheckboxes(spanChk){
var xState=spanChk.checked;
var theBox=spanChk;
elm=theBox.form.elements;//获取form下的所有控件
for(i=0;i<elm.length;i++)
if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
{
if(elm[i].checked!=xState)
elm[i].click();
}
}
</script>
<!--#include file="Connections/conn.asp" -->
<%
'获取所有选中ID串
dim myIds
myIds=request.Form("chkId")
'分离Id到数组
dim ArticleIds
ArticleIds=split(myIds,", ")
'response.write(ubound(ArticleIds))
'连接数据库
'response.write(myIds)
set conn=server.CreateObject("ADODB.Connection")
conn.connectionString=MM_conn_STRING
conn.open
'''''''''''''''''''''''''''''''''''''''''''
'循环删除选中id
dim i
for i=0 to ubound(ArticleIds)
sqlstr="delete from portal_articles where ArticleId="+ArticleIds(i)
conn.execute(sqlstr)
'response.write(sqlstr+"<br />")
next
conn.close
if ubound(ArticleIds)>=0 then response.redirect("admin_articles.asp")'修正dreamweaver自动生成代码仍显示清除记录的Bug
%>