主页主程序:
<%
set conn= Server.CreateObject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("news.mdb")
set rs=conn.execute("select * from news order by id")
%>
<form id="form1" name="form1" method="post" action="op.asp">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><input type="submit" name="button" id="button" value="提交" /></td>
</tr>
<tr>
<td width="80" height="30" align="center"><strong>ID号</strong></td>
<td align="center"><strong>标题</strong></td>
<td width="150" align="center"><strong>时间</strong></td>
<td width="50" align="center"><strong>操作</strong></td>
</tr>
<% do while not rs.eof %>
<tr>
<td height="25" align="center"><%= rs("id") %></td>
<td align="center"><%= rs("title") %></td>
<td><%= rs("fdate") %></td>
<td align="center"><label for="cb">
<input type="checkbox" name="cb" id="cb" value="<%= rs("id") %>"/>
</label></td>
</tr>
<%
rs.movenext
loop
%>
</table>
</form>
删除页面程序:
set conn= Server.CreateObject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("news.mdb")
'response.write request.form("cb")(1)
for each x in request.form("cb")
response.write x&"<p>"
next
conn.execute("delete from news where id in("&request.form("cb")&")")
response.write "<script>alert('您成功删除数据');window.location.reload('index.asp')</script>"