| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 514 人关注过本帖
标题:[原创]自己用的一个批量删除函数和几个模块请指教!
只看楼主 加入收藏
melack
Rank: 1
等 级:新手上路
帖 子:230
专家分:0
注 册:2006-9-27
收藏
 问题点数:0 回复次数:0 
[原创]自己用的一个批量删除函数和几个模块请指教!

conntool.asp

<%weburl=request.serverVariables("Http_REFERER")
dim sql,rs,conn,stritem
sub opendb()
set conn = Server.CreateObject("ADODB.Connection")
conn.open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("DB/#HY_LANJ#.mdb")
end sub
sub closeDB()
If IsObject(conn) Then
if not(conn is nothing) then
conn.close
set conn=nothing
end if
End If
end sub
sub Qtrim(strItem)
strItem=Trim(strItem)
if strItem="" then
trigErr
end if
end sub

sub jdan(strItem)
if inStr("'",strPassword)=1 then
trigErr
end if
end sub

sub tackleOverLen(strItem,intLen)
if len(strItem)>intLen then
trigErr
end if
end sub

function replacePrime(strItem)
if strItem="" then
trigErr
end if
replacePrime=replace(strItem,"'","")
end function
sub trigErr()
showMsg(strItem)
end sub

sub showMsg(strItem)
response.Write "链接数据库发生错误!<a href="&weburl&">请返回</a>"
closedb
response.end
end sub%>

444.asp

<!--#include file="conntool.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="function22.asp">
<%opendb
set rs=server.CreateObject("adodb.recordset")
rs.open"select * from h_yuan",conn,1,1
do while not rs.eof %>
<table width="639" height="26" border="0">
<tr>
<td width="502" height="22"><%=rs("h_name")%></td>
<td width="97"><%if rs("shenhe")="1"then%>己审核
<%else%>未审核
<%end if%></td>
<td width="26"><input name="cb" type="checkbox" id="cb" value="<%=rs("id")%>" /></td>
</tr>
</table>
<%rs.movenext
loop%>

<table width="650" height="21" border="1">
<tr>
<td width="552" align="right"><select name="action" id="action">
<option value="del">删除</option>
<option value="shenhe">审核</option>
<option value="qu">取消</option>
</select></td>
<td width="82"><input name="biao" type="hidden" id="biao" value="h_yuan" />
<input type="submit" name="Submit" value="提交" /></td>
</tr>
</table>
</form>
</body>
</html>

function22.asp

<!--#include file="conntool.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%weburl=request.serverVariables("Http_REFERER")
opendb
sub PLdel(idd,bname,action,wjm)
if idd="" then
showMsg(strItem)
end if
select case action
case "shenhe"
set rs=conn.execute("update "&bname&" set shenhe='1' where id in("&idd&")")
case "qu"
set rs=conn.execute("update "&bname&" set shenhe='0' where id in("&idd&")")
case "del"
idd=Split(idd,",")
for i=0 to ubound(idd)
if wjm<>"" then
sql="select h_image from "&bname&" where id="&id(i)
set rs=objconn.execute(sql)
if rs("h_image")<>"" then
on error resume next
a=rs("h_image")
Set Fso=Server.Createobject("Scripting.FileSystemObject")
Fso.DeleteFile(server.mappath(""&wjm&"\"&a))
set fso=nothing
end if
rs.close
else
sql="delete from "&bname&" where id="&idd(i)
set rs=conn.execute(sql)
end if
next
end select
end sub
sub showMsg(strItem)
response.Write "<script>alert('老大还没有选择呢!');history.back()</script>"
closedb
response.end
end sub
id=request("cb")
action=request("action")
biao=request("biao")
wjm=request("wjm")
call PLdel(id,biao,action,wjm)
response.Redirect weburl
%>
</body>
</html>
自己用的可以批量删除文件夹中的图片函数可以减少代码重复量
请大家多多指教

搜索更多相关主题的帖子: 模块 函数 批量 指教 删除 
2006-12-11 09:36
快速回复:[原创]自己用的一个批量删除函数和几个模块请指教!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018622 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved