<%
ID=Request.Form("ID")
button_value=trim(Request.Form("alert_button"))
if button_value="是" then
conn.execute("delete from doc where docID=" & ID)
else
Response.Redirect "mod1.asp"
end if
%>
请问这段代码哪里有错呀?为什么不能正确删除信息呀?!!
不是中文呀!!
这是上一个页面,名为del.asp
<!--#include file=../../include/conn.asp -->
<%
ID=request("ID")
if ID="" then ‘这部分正确
%>
<script language=javascript>
history.back()
alert("请输入您要删除的文档ID!")
</script>
<%
Response.End
end if
set rs=server.CreateObject ("ADODB.RecordSet")
sqlstring="select * from doc where docID=" & ID
rs.Open sqlstring,conn,1,1
if rs.EOF then
%>
<script language=javascript>
history.back()
alert("非法文档ID,请确认ID不超出当前范围!")
</script>
<%
Response.End
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href=../../doc/admin/law.css rel=stylesheet>
</head>
<body>
<BR><BR><BR>
<form action=del2.asp method=post>
<table border="0" width="550">
<tr>
<td width="100%">
<div align="center"><font color="#FF0000">删除提示:删除后数据将无法恢复,请您三思而后行!</font></div>
</td>
</tr>
<tr>
<td width="100%">
<hr size="1">
</td>
</tr>
<tr>
<td width="100%"></td>
</tr>
<input type="hidden" name="ID" value="<%=docID%>">
<tr>
<td width="100%" align=center><font color="#669999">您删除的文档标题为:[<%=trim(rs("name"))%>]</font><B><font color=red><BR>
</font></b></td>
</tr>
<tr>
<td width="100%">
<div align="center"><b><font color="#FF0000" size="4">确认删除吗?</font></b></div>
</td>
</tr>
<tr>
<td width="100%" align="center" ><input type=submit value="是" name="alert_button"> <input type=submit value="否" name="alert_button"></td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
</table></form>
</body>
</html>
出错代码的页面为del2.asp
[此贴子已经被作者于2005-11-12 16:17:33编辑过]