asp如何对欲删除的记录确认后再删除?
时间:2009-11-20 18:48:00
看看这个指令在ASP程序中的应用,有[delete from 歌手 where 艺名='cs2000'],删除艺名为cs2000的记录:
<%
set conn1=server.createobject("adodb.connection")
conn1.open"driver={sql server};server=(local);uid=sa;pwd=;database=地域"
sql="delete from 歌手 where 艺名='cs2000'"
set a=conn1.execute(sql)
set rs3=server.createobject("adodb.recordset")
sql="select * from 歌手 order by 种类 desc"
rs3.open sql,conn1,3,3
%>
<table colspan=8 cellpadding=5 border=0>
<tr>
<td align=center bgcolor="#800000"><font color="#FFFFFF">艺名
</font></td>
<td align=center bgcolor="#800000"><font color="#FFFFFF">原名
</font></td>
<td align=center bgcolor="#800000"><font color="#FFFFFF">年龄
</font></td>
<td align=center bgcolor="#800000"><font color="#FFFFFF">艺龄
</font></td>
</tr>
<% do while not rs3.eof%>
<tr>
<td bgcolor="f7efde" align=center><%=rs3("艺名")%></td>
<td bgcolor="f7efde" align=center><%=rs3("原名")%></td>
<td bgcolor="f7efde" align=center><%=rs3("年龄")%></td>
<td bgcolor="f7efde" align=center><%=rs3("艺龄")%></td>
</tr>
<%
rs3.movenext
loop
rs3.close
conn1.close
%>
</table>
在用户端浏览器,我们可以看到执行的结果,代码号为cs2000的记录被删除了。