1.asp
<%
set Conn=server.createobject("adodb.Connection")
conn.open="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath("db1.mdb")
set rs=server.createobject("adodb.recordset")
function connClose
Conn.close
Set conn = Nothing
End Function
%>
<SCRIPT LANGUAGE="JavaScript">
function admin(text,url)
{
if(confirm(text)){location=url}
}
</SCRIPT>
<style type="text/css">
<!--
body { font-size: 9pt}
table { font-size: 9pt}
select { font-size: 9pt}
input { font-size: 9pt}
textarea { font-size: 9pt}
.smallbox { font-size: 1pt}
.p9 { font-size: 9pt}
a:visited {text-decoration: none}
a:link { font-size: 9pt; text-decoration: none}
a:hover { font-size: 9pt;text-decoration:underline}
-->
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
sql="SELECT * from nodes "
rs.open sql,conn,1,3
do while not rs.eof
%>
<tr>
<td><%=rs("name")%></td>
<td><a onclick='admin("你确定要删除此贴和相关回复吗?","2.asp?id=<%=rs("id")%>")' onMouseMove="this.style.cursor='hand'"><font color="#CC0000">[删除]</font></a></td>
</tr>
<%
rs.movenext
loop
%>
</table>
2.asp
<%
set Conn=server.createobject("adodb.Connection")
conn.open="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath("db1.mdb")
set rs=server.createobject("adodb.recordset")
function connClose
Conn.close
Set conn = Nothing
End Function
%>
<% id =request("id")
sql="SELECT * from nodes where id="&id&""
rs.open sql,conn,1,3
rs.delete
rs.close
response.redirect"1.asp"
%>
db1.mdb表名:nodes
字段:
id 自动编号
name 文本