| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 511 人关注过本帖
标题:请高手帮忙看下应该怎么办
只看楼主 加入收藏
xiaoyaozi321
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-12-28
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
请高手帮忙看下应该怎么办
谁能帮我看下下面的代码,应该怎么增加点击删除数据库的同时,能够删除上传的upload里的源文件,应该在哪插入代码,我是新手,请高人帮忙。谢谢!!
<%
  if session("admin")="" then
  response.redirect "admin.asp"
  else
if session("flag")>2 then
response.write "<br><p align=center>您没有操作的权限</p>"
response.end
end if
  end if
  ClassID=Request("ClassID")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<link rel="stylesheet" type="text/css" href="admin.css">
<SCRIPT language=JavaScript>
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</SCRIPT>
</head>
<BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<!--#include virtual="/inc/conn.asp"-->
<%
  const MaxPerPage=18
  dim totalPut   
  dim CurrentPage
  dim TotalPages
  dim i,j
  dim idlist
  dim title
title=request("txtitle")
  if not isempty(request("page")) then
  currentPage=cint(request("page"))
  else
  currentPage=1
  end if
  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
%>
<div align="center">
<br>
  <table border="0" width="95%" cellspacing="0" cellpadding="0">
  <tr>
  <td width="100%">
  <div align="center"> </div>
<form name="searchsoft" method="POST" action="dm_mana.asp?ClassID=<%=ClassID%>">
查找相关:   
  <input class=smallInput type="text" name="txtitle" size="13">&nbsp;<input type="submit" value="查 询" name="title" class=buttonface>
</form>
<form method=Post action="dm_mana.asp?ClassID=<%=ClassID%>">
  <div align="center">
<%  
if title<>"" then
sql="select * from DMzz where DMText like '%"&trim(title)&"%' and ClassID="&ClassID&" order by ID desc"
else
sql="select * from DMzz where ClassID="&ClassID&" order by ID desc"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1

  if rs.eof and rs.bof then
  response.write "<p align='center'> 还 没 有 任 何 文 章 </p>"
  else
  totalPut=rs.recordcount
  if currentpage<1 then
  currentpage=1
  end if
  if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

  end if
  if currentPage=1 then
  showpage totalput,MaxPerPage,"Dm_mana.asp"
  showContent
  showpage totalput,MaxPerPage,"Dm_mana.asp"
  else
  if (currentPage-1)*MaxPerPage<totalPut then
  rs.move (currentPage-1)*MaxPerPage
  dim bookmark
  bookmark=rs.bookmark
  showpage totalput,MaxPerPage,"Dm_mana.asp"
  showContent
  showpage totalput,MaxPerPage,"Dm_mana.asp"
  else
currentPage=1
  showpage totalput,MaxPerPage,"Dm_mana.asp"
  showContent
  showpage totalput,MaxPerPage,"Dm_mana.asp"
end if
end if
  rs.close
  end if
   
  set rs=nothing   
  conn.close
  set conn=nothing
   
  sub showContent
  dim i
i=0
%>
  <div align="center">
  <table cellpadding="2" cellspacing="1" border="0" width="100%" class="tableBorder" align=center>
  <tr>   
  <th align=left colspan=4 height=23>修改删除管理</th>
  </tr>
  <tr>   
  <td width="9%" align="center" height="20" class="forumRow"><strong>ID</strong></td>
  <td width="60%" height="20" align="center" class="forumRow"><strong>名称</strong></td>   
  <td width="12%" height="20" align="center" class="forumRow"><b>点击数</b></td>
  <td width="19%" height="20" align="center" class="forumRow">   
  <input type='submit' class=buttonface value='删 除'> </td>
  </tr>


  <%do while not rs.eof%>
<%ID=rs("ID")%>
<!--#include file="RevTJ.asp"-->
  <tr>   
  <td height="20" width="9%" class="forumRow">   
  <p align="center"><%=rs("ID")%></td>
  <td width="60%" height="20" class="forumRow"><a href="dm_edit.asp?ID=<%=rs("ID")%>&ClassID=<%=rs("ClassID")%>" title="点击编辑"><%=rs("DMname")%>   
  </a></td>
  <td height="20" align="center" class="forumRow"><%=rs("Number")%></td>
  <td width="19%" height="20" class="forumRow">   
  <p align="center">   
  <input type='checkbox' name='selAnnounce' value='<%=cstr(rs("ID"))%>'>
  </td>
  </tr>
  <%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
  </table>
</div>
<%
end sub   

function showpage(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
  n= totalnumber \ maxperpage
  else
  n= totalnumber \ maxperpage+1
  end if
  response.write "<br>&nbsp;"
  if CurrentPage<2 then
  response.write "<font color='#000080'>首页 上一页</font>&nbsp;"
  else
  response.write "<a href="&filename&"?page=1>首页</a>&nbsp;"
  response.write "<a href="&filename&"?page="&CurrentPage-1&"&ClassID="&ClassID&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
  response.write "<font color='#000080'>下一页 尾页</font>"
  else
  response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&ClassID="&ClassID&">"
  response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
  end if
  response.write "<font color='#000080'>&nbsp;页次:</font><strong><font color=red>"&CurrentPage&"</font><font color='#000080'>/"&n&"</strong>页</font> "
  response.write "<font color='#000080'>&nbsp;共<b>"&totalnumber&"</b>篇 <b>"&maxperpage&"</b>篇/页</font><br><br>"
   
end function

sub deleteannounce(id)
  dim rs,sql
  set rs=server.createobject("adodb.recordset")
  sql="delete from Dmzz where ID="&cstr(id)
  conn.execute sql
  if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
  else
  response.write "操作成功!<br>"
  end if
End sub
%>
  </div></form></td>
  </tr>
</table>
</div>
</body>
</html>
搜索更多相关主题的帖子: 怎么办 数据库 Microsoft Request content 
2011-12-28 13:25
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:10 
删除upload里的图片要获得upload图片的路径
2011-12-28 16:00
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:10 
在删除前面做处理,后再删除数据。

QQ:63572063
2011-12-28 21:35
快速回复:请高手帮忙看下应该怎么办
数据加载中...
 
   



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

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