一个用隐藏域修删除数据库记录的代码
2006-07-30 20:15
381 查看
前台文件:
<!--#include file="../conn/conn.asp"-->
<table border="1" cellspacing=1 align="center" width="92%">
<tr CLASS=TR1>
<td align="center" class=td2><font color="#000000">操作</font></td>
<td align="center" class=td2><font color="#000000">题目编号</font></td>
<td align="center" class=td2><font color="#000000">题目标题</font></td>
<td align="center" class=td2><font color="#000000">指导老师</font></td>
<td align="center" class=td2><font color="#000000">课题性质</font></td>
<td align="center" class=td2><font color="#000000">教研室</font></td>
<td align="center" class=td2><font color="#000000">是否审核</font></td>
<td align="center" class=td2><font color="#000000">是否以选</font></td>
<td align="center" class=td2><font color="#000000">备注</font></td>
</tr>
<% on error resume next
Set RS = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT * FROM topic"
RS.OPEN strSql,CONN,1
do while not rs.eof
%>
<tr>
<td align="center" height="19"><form id="form1" name="form1" method="post" action="topic_del.asp">
<input type="hidden" name="hiddenField" value="<%=trim(rs("topic_no"))%>">
<input type="submit" name="Submit" value="删除" onclick="{if(confirm('您确定要删除此题目吗?')){return true;}return false;}">
</form></td>
<td align="center" height="19"><%=trim(rs("topic_no"))%></td>
<td align="center" height="19"><%=trim(rs("topic_name"))%></td>
<td align="center" height="19"><%=trim(rs("topic_tch_name"))%></td>
<td align="center" height="19"><%=trim(rs("topic_prop"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_jys"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_pass"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_flag"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_memo"))%> </td>
</tr>
<% rs.movenext
loop
rs.close
set rs = nothing
%>
<%
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%>
后台处理文件
<!--#include file="../conn/conn.asp"-->
<%
id=request("hiddenField")
SqlStr = "delete from topic where topic_no=" & id
Conn.Execute(SqlStr)
response.write"<script>alert('已经成功删除!');location='topic_view.asp'</script>"
%>
<!--#include file="../conn/conn.asp"-->
<table border="1" cellspacing=1 align="center" width="92%">
<tr CLASS=TR1>
<td align="center" class=td2><font color="#000000">操作</font></td>
<td align="center" class=td2><font color="#000000">题目编号</font></td>
<td align="center" class=td2><font color="#000000">题目标题</font></td>
<td align="center" class=td2><font color="#000000">指导老师</font></td>
<td align="center" class=td2><font color="#000000">课题性质</font></td>
<td align="center" class=td2><font color="#000000">教研室</font></td>
<td align="center" class=td2><font color="#000000">是否审核</font></td>
<td align="center" class=td2><font color="#000000">是否以选</font></td>
<td align="center" class=td2><font color="#000000">备注</font></td>
</tr>
<% on error resume next
Set RS = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT * FROM topic"
RS.OPEN strSql,CONN,1
do while not rs.eof
%>
<tr>
<td align="center" height="19"><form id="form1" name="form1" method="post" action="topic_del.asp">
<input type="hidden" name="hiddenField" value="<%=trim(rs("topic_no"))%>">
<input type="submit" name="Submit" value="删除" onclick="{if(confirm('您确定要删除此题目吗?')){return true;}return false;}">
</form></td>
<td align="center" height="19"><%=trim(rs("topic_no"))%></td>
<td align="center" height="19"><%=trim(rs("topic_name"))%></td>
<td align="center" height="19"><%=trim(rs("topic_tch_name"))%></td>
<td align="center" height="19"><%=trim(rs("topic_prop"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_jys"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_pass"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_flag"))%> </td>
<td align="center" height="19"><%=trim(rs("topic_memo"))%> </td>
</tr>
<% rs.movenext
loop
rs.close
set rs = nothing
%>
<%
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%>
后台处理文件
<!--#include file="../conn/conn.asp"-->
<%
id=request("hiddenField")
SqlStr = "delete from topic where topic_no=" & id
Conn.Execute(SqlStr)
response.write"<script>alert('已经成功删除!');location='topic_view.asp'</script>"
%>
相关文章推荐
- 一个简单的dbm数据库的实验-----dbm打开 存储 检索 删除 扫描操作的C代码
- 在删除数据库记录前弹出一个对话框,和确认按钮和取消按钮
- jsp页面功能是向数据库删除一条记录,如果删除成功,JSP页面上弹出一个提示框告诉用户添删除成功!
- 记录师兄写的一个从数据库获取省份的代码
- asp删除mssql数据库中没有记录的图片代码
- 批量删除数据库记录的ASP代码
- asp 删除数据库记录的代码
- asp删除mssql数据库中没有记录的图片代码
- asp 删除数据库记录的代码
- Delphi利用ADO连接数据库报错“bof或eof中有一个是真,或者当前记录已被删除,所需的操作要求一个当前的操作”
- 数据库表中有重复记录,如何删除这些重复记录保留ID最大的一个信息
- 在删除数据库记录前弹出一个对话框,和确认按钮和取消按钮
- 千万级数据库(MSSQL)删除重复记录
- oracle中删除一个表的记录的同时,保存到另一个表的触发器
- php和数据库结合的一个简单的web实例 代码分析 (php初学者)
- 用Access作为后台数据库支撑,书写一个用C#写入记录的案例
- 2.7 请写出一段Python代码实现删除一个list里面的重复元素
- SqlServer中使用row_number()在一个查询中删除重复记录
- 在gridControl中删除一条数据库记录(C#版)
- 【转】我刚做的一个TreeView的CheckBox进行选中插入数据库,从数据库中读取数据后让CheckBox勾选的代码!