首先用代码
<a href="editNews.asp?id=<%=rswm("id")%>">编辑</a>
这样就把id传到editNews.asp页面
然后在editNews.asp页面用newsid=request("id")
接受到这个值
在学习.net时页面传值用了好长时间才明白
现在学习ASP方便了很多。
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--#include file="Config/WebConfig.asp"-->
<!--#include file="Config/WebConfig.asp"-->
 <html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<head>
 <title>asp版新闻发布</title>
<title>asp版新闻发布</title>
 </head>
</head>
 <body>
<body>    


 <%
        <% 

 if request.QueryString("action")="del" then
    if request.QueryString("action")="del" then    
 dim ok
        dim ok
 dim ok2
            dim ok2
 ok=request.Form("id")
            ok=request.Form("id")
 ok2=split(ok,", ")
            ok2=split(ok,", ")
 response.Write(ok2(i))
            response.Write(ok2(i))
 
                    
 For i = 0 To UBound(ok2)
                For i = 0 To UBound(ok2)         
 response.Write("您选的第"& i+1 &"个ID:" & ok2(i)& "<br />")
                    response.Write("您选的第"& i+1 &"个ID:" & ok2(i)& "<br />")
 conn.execute("DELETE FROM [dbh171001].[h171001].[PowerSite_User_Disp] where userid=" & ok2(i))
                    conn.execute("DELETE FROM [dbh171001].[h171001].[PowerSite_User_Disp] where userid=" & ok2(i))        
 Next
                Next 
 
            
 response.Redirect("showNews.asp?action=delok")
             response.Redirect("showNews.asp?action=delok")
 
                
 
                
 set conn=nothing
                set conn=nothing

 end if
    end if
 
        
 
        
 sqlwm = "SELECT  * FROM PowerSite_User_Disp"
        sqlwm = "SELECT  * FROM PowerSite_User_Disp"
 set rswm= server.CreateObject("adodb.recordset")
        set rswm= server.CreateObject("adodb.recordset")
 rewm=nothing
        rewm=nothing
 rswm.open sqlwm,conn,1,1
        rswm.open sqlwm,conn,1,1
 
        
 
        
 %>
%>
 <form action="shownews.asp?action=del" method="post" name="f" >
<form action="shownews.asp?action=del" method="post" name="f" >


 <a href="addnews.asp" target="_blank">添加新闻</a>  
<a href="addnews.asp" target="_blank">添加新闻</a>  
 <INPUT type="submit" value="删除"><%if request.QueryString("action")="delok" then response.Write("<font color=red>删除成功!</font>") %>
            <INPUT type="submit" value="删除"><%if request.QueryString("action")="delok" then response.Write("<font color=red>删除成功!</font>") %>
 <br />
            <br />
 <%do while not rswm.eof  %>
            <%do while not rswm.eof  %>
 
             
 <%=rswm("UserID")%>  <%=rswm("msn")%> <%=rswm("qq")%>
            <%=rswm("UserID")%>  <%=rswm("msn")%> <%=rswm("qq")%> 
 
            
 <a href="editNews.asp?id=<%=rswm("userid")%>">编辑</a>
            <a href="editNews.asp?id=<%=rswm("userid")%>">编辑</a>
 <input type="checkbox" name="id" value="<%=rswm("UserID")%>" >
            <input type="checkbox" name="id" value="<%=rswm("UserID")%>" >

 <br />
            <br />
 <%rswm.movenext
            <%rswm.movenext    
 loop
            loop 
 
            
 rewm=nothing
            rewm=nothing
 %>
            %>
 
            
 </form>
</form>     
 
        

 
    
 </body>
</body>
 
 <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
 <!--#include file="Config/WebConfig.asp"-->
<!--#include file="Config/WebConfig.asp"-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
 <title>asp版新闻发布—编辑</title>
<title>asp版新闻发布—编辑</title>
 </head>
</head>

 <body>
<body>
 <%
<%
 newsid=request("id")
newsid=request("id")
 sqlwm = "SELECT * FROM PowerSite_User_Disp where userid="+newsid
    sqlwm = "SELECT * FROM PowerSite_User_Disp where userid="+newsid
 set rswm= server.CreateObject("adodb.recordset")
    set rswm= server.CreateObject("adodb.recordset")
 rswm.open sqlwm,conn,1,1
    rswm.open sqlwm,conn,1,1
 %>
%>
 <SCRIPT LANGUAGE="JavaScript">
<SCRIPT LANGUAGE="JavaScript">
 function checkadd()
function checkadd()
 {
{   
 if (document.postart.dtitle.value.length<1)
  if (document.postart.dtitle.value.length<1)
 {
    {
 alert("请您填写信息标题!");
        alert("请您填写信息标题!");
 document.postart.dtitle.focus();
        document.postart.dtitle.focus();
 return false;
        return false;
 }
    }
 if (document.postart.dtext.value.length<1)
    if (document.postart.dtext.value.length<1)
 {
    {
 alert("请您填写信息内容!");
        alert("请您填写信息内容!");
 document.postart.dtext.focus();
        document.postart.dtext.focus();
 return false;
        return false;
 }
    }
 if (document.postart.dtext.value.length>120)
        if (document.postart.dtext.value.length>120)
 {
    {
 alert("请把信息内容的字数控制在120以内!");
        alert("请把信息内容的字数控制在120以内!");
 document.postart.dtext.focus();
        document.postart.dtext.focus();
 return false;
        return false;
 }
    }
 }
}
 </SCRIPT>
</SCRIPT>
 <SCRIPT LANGUAGE="JavaScript">
<SCRIPT LANGUAGE="JavaScript">      
 maxLen = 120;
maxLen = 120;
 function checkMaxInput(form) {
function checkMaxInput(form) {
 if (form.dtext.value.length > maxLen)
if (form.dtext.value.length > maxLen)
 form.remLen.value = 0;
form.remLen.value = 0;
 else form.remLen.value = maxLen - form.dtext.value.length;
else form.remLen.value = maxLen - form.dtext.value.length;
 }
}
 </script>
</script>
 <form action="" method="post" name="form" onSubmit="return checkadd()">
<form action="" method="post" name="form" onSubmit="return checkadd()">
 <table>
  <table>
 <tr bgcolor="#FFFFFF">
    <tr bgcolor="#FFFFFF">
 <td width="15%" height="26" align="right">新闻标题:</td>
      <td width="15%" height="26" align="right">新闻标题:</td>
 <td width="65%" height="26"><input type="text" name="dtitle" size="70%" maxlength="20" value="<%=rswm("msn") %>">
      <td width="65%" height="26"><input type="text" name="dtitle" size="70%" maxlength="20" value="<%=rswm("msn") %>">
 <font color="#FF0000">* 20字以内</font></td>
        <font color="#FF0000">* 20字以内</font></td>
 </tr>
    </tr>
 <tr bgcolor="#FFFFFF">
    <tr bgcolor="#FFFFFF">
 <td align="right">新闻内容:</td>
      <td align="right">新闻内容:</td>
 <td><textarea rows="6" name="dtext" cols="90%" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="txtl" maxlength="120"><%=rswm("QQ")%></textarea>
      <td><textarea rows="6" name="dtext" cols="90%" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="txtl" maxlength="120"><%=rswm("QQ")%></textarea>
 <font color="#FF0000">* 120字以内</font></td>
        <font color="#FF0000">* 120字以内</font></td>
 </tr>
    </tr>
 <tr>
    <tr>
 <td height="26" align="right" bgcolor="#FFFFFF"> </td>
      <td height="26" align="right" bgcolor="#FFFFFF"> </td>
 <td height="26" bgcolor="#FFFFFF"><font color="#FF0000">目前还可以写
      <td height="26" bgcolor="#FFFFFF"><font color="#FF0000">目前还可以写
 <input readonly type=text name=remLen size=2 maxlength=2 value="120" style="border: 1 solid #888888">
        <input readonly type=text name=remLen size=2 maxlength=2 value="120" style="border: 1 solid #888888">
 个字</font></td>
        个字</font></td>
 </tr>
    </tr>
 <tr>
    <tr>
 <td><input type="submit" value="更新" name="submit"></td>
      <td><input type="submit" value="更新" name="submit"></td>
 </tr>
    </tr>
 
    
 <%
    <%
 
    
 dim newscontent,newstitle
dim newscontent,newstitle
 newscontent=replace(trim(Request.Form("dtext")),"'","‘")
newscontent=replace(trim(Request.Form("dtext")),"'","‘")
 newstitle=replace(trim(Request.Form("dtitle")),"'","‘")
newstitle=replace(trim(Request.Form("dtitle")),"'","‘")
 if(newscontent <>"") then
if(newscontent <>"") then

 Sql="UPDATE [dbh171001].[h171001].[PowerSite_User_Disp] SET [MSN] = '"&newstitle&"',QQ='"&newscontent&"' where userid="
Sql="UPDATE [dbh171001].[h171001].[PowerSite_User_Disp] SET [MSN] = '"&newstitle&"',QQ='"&newscontent&"' where userid="

 Set Rs=Conn.execute(Sql)
        Set Rs=Conn.execute(Sql)
 
        
 Response.Write ("<script>alert('恭喜您!更新成功!');window.close();</script>")
Response.Write ("<script>alert('恭喜您!更新成功!');window.close();</script>")
 end if
end if
 %>
%>
 
    
 </table>
  </table>
 </form>
</form>
 </body>
</body>
 </html>
</html>
 
<a href="editNews.asp?id=<%=rswm("id")%>">编辑</a>
这样就把id传到editNews.asp页面
然后在editNews.asp页面用newsid=request("id")
接受到这个值
在学习.net时页面传值用了好长时间才明白
现在学习ASP方便了很多。
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!--#include file="Config/WebConfig.asp"-->
<!--#include file="Config/WebConfig.asp"--> <html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<head> <title>asp版新闻发布</title>
<title>asp版新闻发布</title> </head>
</head> <body>
<body>    

 <%
        <% 
 if request.QueryString("action")="del" then
    if request.QueryString("action")="del" then     dim ok
        dim ok dim ok2
            dim ok2 ok=request.Form("id")
            ok=request.Form("id") ok2=split(ok,", ")
            ok2=split(ok,", ") response.Write(ok2(i))
            response.Write(ok2(i)) 
                     For i = 0 To UBound(ok2)
                For i = 0 To UBound(ok2)          response.Write("您选的第"& i+1 &"个ID:" & ok2(i)& "<br />")
                    response.Write("您选的第"& i+1 &"个ID:" & ok2(i)& "<br />") conn.execute("DELETE FROM [dbh171001].[h171001].[PowerSite_User_Disp] where userid=" & ok2(i))
                    conn.execute("DELETE FROM [dbh171001].[h171001].[PowerSite_User_Disp] where userid=" & ok2(i))         Next
                Next  
             response.Redirect("showNews.asp?action=delok")
             response.Redirect("showNews.asp?action=delok") 
                 
                 set conn=nothing
                set conn=nothing
 end if
    end if 
         
         sqlwm = "SELECT  * FROM PowerSite_User_Disp"
        sqlwm = "SELECT  * FROM PowerSite_User_Disp" set rswm= server.CreateObject("adodb.recordset")
        set rswm= server.CreateObject("adodb.recordset") rewm=nothing
        rewm=nothing rswm.open sqlwm,conn,1,1
        rswm.open sqlwm,conn,1,1 
         
         %>
%> <form action="shownews.asp?action=del" method="post" name="f" >
<form action="shownews.asp?action=del" method="post" name="f" >

 <a href="addnews.asp" target="_blank">添加新闻</a>  
<a href="addnews.asp" target="_blank">添加新闻</a>   <INPUT type="submit" value="删除"><%if request.QueryString("action")="delok" then response.Write("<font color=red>删除成功!</font>") %>
            <INPUT type="submit" value="删除"><%if request.QueryString("action")="delok" then response.Write("<font color=red>删除成功!</font>") %> <br />
            <br /> <%do while not rswm.eof  %>
            <%do while not rswm.eof  %> 
              <%=rswm("UserID")%>  <%=rswm("msn")%> <%=rswm("qq")%>
            <%=rswm("UserID")%>  <%=rswm("msn")%> <%=rswm("qq")%>  
             <a href="editNews.asp?id=<%=rswm("userid")%>">编辑</a>
            <a href="editNews.asp?id=<%=rswm("userid")%>">编辑</a> <input type="checkbox" name="id" value="<%=rswm("UserID")%>" >
            <input type="checkbox" name="id" value="<%=rswm("UserID")%>" >
 <br />
            <br /> <%rswm.movenext
            <%rswm.movenext     loop
            loop  
             rewm=nothing
            rewm=nothing %>
            %> 
             </form>
</form>      
        
 
     </body>
</body>
 <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="Config/WebConfig.asp"-->
<!--#include file="Config/WebConfig.asp"--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>asp版新闻发布—编辑</title>
<title>asp版新闻发布—编辑</title> </head>
</head>
 <body>
<body> <%
<% newsid=request("id")
newsid=request("id") sqlwm = "SELECT * FROM PowerSite_User_Disp where userid="+newsid
    sqlwm = "SELECT * FROM PowerSite_User_Disp where userid="+newsid set rswm= server.CreateObject("adodb.recordset")
    set rswm= server.CreateObject("adodb.recordset") rswm.open sqlwm,conn,1,1
    rswm.open sqlwm,conn,1,1 %>
%> <SCRIPT LANGUAGE="JavaScript">
<SCRIPT LANGUAGE="JavaScript"> function checkadd()
function checkadd() {
{    if (document.postart.dtitle.value.length<1)
  if (document.postart.dtitle.value.length<1) {
    { alert("请您填写信息标题!");
        alert("请您填写信息标题!"); document.postart.dtitle.focus();
        document.postart.dtitle.focus(); return false;
        return false; }
    } if (document.postart.dtext.value.length<1)
    if (document.postart.dtext.value.length<1) {
    { alert("请您填写信息内容!");
        alert("请您填写信息内容!"); document.postart.dtext.focus();
        document.postart.dtext.focus(); return false;
        return false; }
    } if (document.postart.dtext.value.length>120)
        if (document.postart.dtext.value.length>120) {
    { alert("请把信息内容的字数控制在120以内!");
        alert("请把信息内容的字数控制在120以内!"); document.postart.dtext.focus();
        document.postart.dtext.focus(); return false;
        return false; }
    } }
} </SCRIPT>
</SCRIPT> <SCRIPT LANGUAGE="JavaScript">
<SCRIPT LANGUAGE="JavaScript">       maxLen = 120;
maxLen = 120; function checkMaxInput(form) {
function checkMaxInput(form) { if (form.dtext.value.length > maxLen)
if (form.dtext.value.length > maxLen) form.remLen.value = 0;
form.remLen.value = 0; else form.remLen.value = maxLen - form.dtext.value.length;
else form.remLen.value = maxLen - form.dtext.value.length; }
} </script>
</script> <form action="" method="post" name="form" onSubmit="return checkadd()">
<form action="" method="post" name="form" onSubmit="return checkadd()"> <table>
  <table> <tr bgcolor="#FFFFFF">
    <tr bgcolor="#FFFFFF"> <td width="15%" height="26" align="right">新闻标题:</td>
      <td width="15%" height="26" align="right">新闻标题:</td> <td width="65%" height="26"><input type="text" name="dtitle" size="70%" maxlength="20" value="<%=rswm("msn") %>">
      <td width="65%" height="26"><input type="text" name="dtitle" size="70%" maxlength="20" value="<%=rswm("msn") %>"> <font color="#FF0000">* 20字以内</font></td>
        <font color="#FF0000">* 20字以内</font></td> </tr>
    </tr> <tr bgcolor="#FFFFFF">
    <tr bgcolor="#FFFFFF"> <td align="right">新闻内容:</td>
      <td align="right">新闻内容:</td> <td><textarea rows="6" name="dtext" cols="90%" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="txtl" maxlength="120"><%=rswm("QQ")%></textarea>
      <td><textarea rows="6" name="dtext" cols="90%" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="txtl" maxlength="120"><%=rswm("QQ")%></textarea> <font color="#FF0000">* 120字以内</font></td>
        <font color="#FF0000">* 120字以内</font></td> </tr>
    </tr> <tr>
    <tr> <td height="26" align="right" bgcolor="#FFFFFF"> </td>
      <td height="26" align="right" bgcolor="#FFFFFF"> </td> <td height="26" bgcolor="#FFFFFF"><font color="#FF0000">目前还可以写
      <td height="26" bgcolor="#FFFFFF"><font color="#FF0000">目前还可以写 <input readonly type=text name=remLen size=2 maxlength=2 value="120" style="border: 1 solid #888888">
        <input readonly type=text name=remLen size=2 maxlength=2 value="120" style="border: 1 solid #888888"> 个字</font></td>
        个字</font></td> </tr>
    </tr> <tr>
    <tr> <td><input type="submit" value="更新" name="submit"></td>
      <td><input type="submit" value="更新" name="submit"></td> </tr>
    </tr> 
     <%
    <% 
     dim newscontent,newstitle
dim newscontent,newstitle newscontent=replace(trim(Request.Form("dtext")),"'","‘")
newscontent=replace(trim(Request.Form("dtext")),"'","‘") newstitle=replace(trim(Request.Form("dtitle")),"'","‘")
newstitle=replace(trim(Request.Form("dtitle")),"'","‘") if(newscontent <>"") then
if(newscontent <>"") then
 Sql="UPDATE [dbh171001].[h171001].[PowerSite_User_Disp] SET [MSN] = '"&newstitle&"',QQ='"&newscontent&"' where userid="
Sql="UPDATE [dbh171001].[h171001].[PowerSite_User_Disp] SET [MSN] = '"&newstitle&"',QQ='"&newscontent&"' where userid="
 Set Rs=Conn.execute(Sql)
        Set Rs=Conn.execute(Sql) 
         Response.Write ("<script>alert('恭喜您!更新成功!');window.close();</script>")
Response.Write ("<script>alert('恭喜您!更新成功!');window.close();</script>") end if
end if %>
%> 
     </table>
  </table> </form>
</form> </body>
</body> </html>
</html>
 
                    
                     
                    
                 
                    
                 
 
         
        

 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号