当前位置: 代码迷 >> ASP >> action的位置应该在哪?解决办法
  详细解决方案

action的位置应该在哪?解决办法

热度:103   发布时间:2012-02-14 19:19:19.0
action的位置应该在哪?
当操作修改删除时,要求执行action,跳到相应的操作,可是我点击“删除”“修改”按钮时不进行操作,修改捕获rs( "id ")值,而删除没有,请问是为什么啊,是不是action的位置不对?谢谢,很急!
<body   leftmargin= "2 "   topmargin= "0 "   marginwidth= "0 "   marginheight= "0 ">
<%
action=request.Form( "Action ")
select   case   action
case   "Del "   call   Del
case   "Modify "   call   Modify
case   else     call   showContent
end   select
%>
<%sub   showContent
dim   Num
        Num=0
page=Clng(request( "page "))
Set   rs=   Server.CreateObject( "ADODB.Recordset ")
sql= "select     id,Bumen,Zhiwei,Xueli,Year_exp,Age_down,Age_up,Sex,Num_people,Obligation,Demo_other,Treatment,Creat_time   from   Zhaopin_info   order   by   id   desc "
rs.open   sql,conn,1,1
rs.pagesize=4
if   page <1   then   page=1
if   page> rs.pagecount   then   page=rs.pagecount
rs.Absolutepage=page
%>
……
<%   for   i=1   to   rs.pagesize%>
<tr   class= "tdbg "   onMouseOver= "this.style.backgroundColor= '#BFDFFF ' "   onMouseOut= "this.style.backgroundColor= ' ' ">  
                        <td   width= "24 "   align= "center ">
<input   name= 'ID '   type= 'checkbox '   onClick= "unselectall() "   id= "ID "   value= "&id& "> </td>
……

<td   align= "center "> <input   name= "Action "   type= "hidden "   id= "Action "   value= "Modify ">
<a   href= "mgrzhaopin_show_new.asp?Action=modify&id= <%=rs( "id ")%> "> 修改 </a> &nbsp;
</td>
    </tr>
<%
      rs.movenext
      if   rs.eof   then   exit   for
      next
%>
<%
sub   Del()
dim   id
id=request.Form( "ID ")
response.Write(id)
response.End()
if   id= " "   then
msgbox( "您还没有选择要删除的对象 ")
exit   sub
end   if
sql= "select   *   from   zhaopin_info   where   id= "&id& " "
set   rs=server.createobject( "adodb.recordset ")
rs.open   sql,conn,1,3
response.Write(sql)
response.End()
do   while   not   rs.eof
rs.delete
rs.update
rs.movenext
loop
rs.close
set   rs=nothing
call   showContent
end   sub
%>


------解决方案--------------------
action=request.Form( "Action ") 改为:action=request.querystring( "Action ").

<input name= "Action " type= "hidden " id= "Action " value= "Modify "> 这句不要.

下面两句是 修改 删除 的链接
<a href= "mgrzhaopin_show_new.asp?Action=modify&id= <%=rs( "id ")%> "> 修改 </a> &nbsp;
<a href= "mgrzhaopin_show_new.asp?Action=Del&id= <%=rs( "id ")%> "> 删除 </a>
  相关解决方案