asp我该如何删除数据库中满足条件的记录

2025-01-01 11:56:12
推荐回答(5个)
回答1:

真正无错的代码:

<%
id=trim(request("id"))
names=trim(request("name"))
if id<>"" and names<>"" then
sql="select * from tel where id="& id &" name='"& names &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof or rs.bof then
response.write ""
else
rs.delete
rs.update
end if
rs.close
set rs=nothing
else
response.write ""
end if
%>

另外提醒一下楼上几位,不知道就别来混分,欺骗别人感情!
记录集都没有定义怎么删除记录?鄙视一下~

回答2:

<%
id=trim(request("id"))
name=trim(request("name"))
sql="select * from tel where id="& clng(id) &" name="& names
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write ""
else
rs.delete
rs.update
end if
rs.close
set rs=nothing
%>
这个应该没问题
记得给分,若还有问题何以Hi我。

回答3:

真正无错的代码:

<%
id=trim(request("id"))
names=trim(request("name"))
if id<>"" and names<>"" then
sql="select * from tel where id="& id &" name='"& names &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof or rs.bof then
response.write ""
else
rs.delete
rs.update
end if
rs.close
set rs=nothing
else
response.write ""
end if
%>

另外提醒一下楼上几位,不知道就别来混分,欺骗别人感情!
记录集都没有定义怎么删除记录?鄙视一下~

回答4:

<%
id=trim(request("id"))
name=trim(request("name"))
sql="select * from tel where id="& clng(id) &" name="& names
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write ""
else
rs.delete
rs.update
end if
rs.close
set rs=nothing
%>
这个应该没问题
记得给分,若还有问题何以Hi我。

回答5:

全部代码如下~!!
<%
dim id,name,Rs
id = request.querystring("id")
name = request.querystring("name")
sql = "select * from tel where id=" & id &" and name='"&name&"'"
set Rs=Conn.Execute sql
if Rs.Eof and Rs.Bof then
%>

<%else
sql = "delete from tel where id=" & id &" and name="&name
Conn.Execute sql
%>