ASP+ACCESS 读取包含指定字段的数据 怎么实现删除功能?

来源:百度知道 编辑:UC知道 时间:2024/06/24 00:06:27
表1:admin 表2:biao
表2里的字段:ID DQ NL SG TZ addtime
现在读取、删除全部数据是正常的,我想把 biao中 DQ字段为'北京'的数据单独读取出来,并且能逐条和全部删除。该怎么做?请指教,谢谢!
ASP代码如下:
<!--#include file="conn.asp"-->
<!--#include file="pageCls.asp"-->
<html>
<head>
<title>全国调查表</title>
<script>
function sel()
{
o=document.getElementsByName("delid")
for(i=0;i<o.length;i++)
o[i].checked=event.srcElement.checked
}
</script>
</head>
<body bgcolor="#FFD89D" leftmargin="2" topmargin="2">

<div>
<%
if not isempty(request.Form("delid")) then
id=trim(request("delid"))
sql="delete from "&table2&" where id in ("&cstr(id)&")"
conn.execute sql
end if
dim txtSearch,orderlist
dim Rs,Sql
txtSearch=trim(reque

想要逐条删除的话,可以根据ID 字段内容进行删除,
delete * from biao where ID ='ID值';
如果想要将DQ字段为'北京'的记录全部删除的话,
就使用
delete * from biao where DQ=‘北京’
呵呵,希望能有帮助,^_^

delete * from biao where DQ=‘北京’;