ASP修改数据的错误

来源:百度知道 编辑:UC知道 时间:2024/05/16 15:11:56
<form id="form" method="post" action="xiubumen1.asp" >
<tr>
<td height="21" align="center"><div align="center">选择修改:</div></td>
<td width="130" height="21" align="center"><div align="left">
<select name="id" onchange="">

<option value="办公室" selected>研发室</option>
<option value="人事部">人事部 </option>
<option value="销售部">销售部 </option>
</select>
</div></td>
<td width="231" height="21" align="center"

<!--#include file="data/conn.asp"-->

<%
bumen=request.Form("bumen")
miaoshu=request.Form("miaoshu")
id=request.Form("id")
if bumen<>"" then
set rs=server.createobject("adodb.recordset")
rs1="select * from bumen where bumen.bumen='"&id&"'"
rs.open rs1,conn,1,3
if rs.eof and rs.bof then
rs1="update bumen set bumen='"&bumen&"',miaoshu='"&miaoshu&"' where id="&id
conn.execute(rs1)
%>
<script language="javascript">
alert("操作成功!!");
window.location.href="rizhi.asp";
</script>
<%else%>
<script language="javascript">
alert("操作失败!!");

</script>
<% end if
end if %>

先试下这个。如果出错,打开数据库看bumen和id的字段属性是文本还是自动编号。如果是文本id两边加半角的单引号。