我想实现在留言本中 删除留言的功能。具体代码,哪位大虾能给提供。在线等。
具体的代码。 问题点数:0、回复次数:5Top
1 楼bineon(雪冬寒)回复于 2003-08-03 19:55:44 得分 0
你应该能得到需要删除的留言的id,
sql="delete 表名 where id="&request("id")
conn.execute
应该是这样吧,上面的sql不知道写的对不对,你试试!Top
2 楼ronanlin(旭)回复于 2003-08-04 00:50:02 得分 0
在删除留言的页面添加一个删除连接。
比较delete.asp?ID=<%=rs("ID")%>
然后在删除页面
sql="delete 表名 where id="&request("ID")
应该就可以实现了吧。Top
3 楼ronanlin(旭)回复于 2003-08-04 00:51:44 得分 0
<!--#include file="conn.asp"-->
<html>
<head>
<title>管理反馈信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="font.css" rel="stylesheet" type="text/css">
<script language="javascript">
function Delete(str){
if (confirm("确定要删除吗?")){
window.location="DeleteFeedBack.asp?ID="+str;
}
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top">
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> <%
const MaxPerPage=10 '第页最大显示产品数 3*5
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
'queryitem=trim(request("Cname"))
sql="select FeedBackID,CompanyName,Linkman,ContactPhone,Email,FeedBackContent,FeedBackTime from FeedBack order by FeedBackTime desc"
'response.Write(sql)
Set rst=Server.CreateObject("ADODB.Recordset")
rst.open sql,conn,3,3
if rst.eof and rst.bof then
%> <script language="javascript">
alert("暂时没有信息!");
window.location="FeedBack.asp"
</script> <%
else
rst.pagesize=10
totalPut=rst.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
showContent
else
if (currentPage-1)*MaxPerPage<totalPut then
rst.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rst.bookmark
showContent
else
currentPage=1
showContent
end if
end if
rst.close
end if
set rst=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=1
%> <br>
<%for i=1 to rst.pageSize
if rst.eof then
exit for
end if
%>
<table width="600" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#000000"><table width="600" height="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="font">
<tr bgcolor="#FFFFFF">
<td width="50" align="center">公司名称</td>
<td width="300"><%=rst("CompanyName")%></td>
<td width="50" align="center">Email</td>
<td><%=rst("Email")%></td>
<td width="50" rowspan="4" align="center" valign="top"><a href="javascript:Delete(<%=rst("FeedBackID")%>)">删除</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center">联系人</td>
<td><%=rst("Linkman")%></td>
<td align="center">反馈时间</td>
<td><%=rst("FeedBackTime")%></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center">联系电话</td>
<td><%=rst("ContactPhone")%></td>
<td align="center"> </td>
<td> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center">反馈内容</td>
<td colspan="3"><%=Replace(rst("FeedBackContent"),"<br/>","<br>")%> </td>
</tr>
</table></td>
</tr>
</table><br>
<%
rst.movenext
next
%> </td>
</tr>
<tr>
<td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="font">
<tr>
<td align="center"></td>
</tr>
<tr>
<td align="center"> <%
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 "<form method=Post action="&filename&" name=form2>"
%> <%
if CurrentPage<2 then
response.write "<font color='#666666'>[第一页] [上一页]</font> "
else
response.write "<a href="&filename&"?page=1><font color=black>[第一页]</font></a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"><font color=black>[上一页]</font></a> "
end if
if n-currentpage<1 then
response.write "<font color='#666666'>[下一页] [最后一页]</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "<font color=black>[下一页]</font></a> <a href="&filename&"?page="&n&"><font color=black>[最后一页]</font></a>"
end if
response.write "<font color='#000000'> 共有:</font><strong><font color=red>"&CurrentPage&"</font><font color='#000000'>/"&n&"</strong>页</font> "
response.write "<font color='#000000'>共有:<b><font color=red>"&totalnumber&"</font></b>条记录</font> "
response.write " <font color='#000000'></font><input type='text' name='page' size=4 maxlength=10 class=smallInput value="¤tpage&">"
response.write " <input type=submit value='GOTO'class=font></span></form>"
end function
%> <% showpage totalput,MaxPerPage,"ViewFeedBack.asp" %> </td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Top
4 楼ronanlin(旭)回复于 2003-08-04 00:52:05 得分 0
<!--#include file="conn.asp"-->
<%
eID=Request("ID")
Set rs=Server.CreateObject ("ADODB.Recordset")
sql="select FeedBackID from FeedBack where FeedBackID="&eID
rs.open sql,conn,3,3
rs.delete
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Redirect "ViewFeedBack.asp"
%>
Top
5 楼earthpea(问莲根,有丝多少?莲心知为谁苦?)回复于 2003-08-04 08:19:29 得分 0
只要定下了sql语句,其他什么都好说
sql = "delete tablename where id = " & idTop




