sql="select * from Department where id=" & request("id")
<%ID=Request.QueryString("ID")Setrs=conn.Execute("select*fromDepartmentwhereID="&ID)%...
<%
ID=Request.QueryString("ID")
Set rs=conn.Execute("select * from Department where ID="&ID)
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
<tr>
<td width="68%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">部门修改</span></div></td>
</tr>
<tr>
<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">
<form action="?action=save" method="post" id="form1">
<input name="name" type="text" id="name" value="<%=rs("name")%>" />
<input type="submit" name="button" id="button" value="提交" />
</form>
</div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30"> </td>
</tr>
</table>
</body>
</html>
<%
rs.Close
Set rs=Nothing
if request("action")="save" then
set rs=Server.CreateObject("ADODB.recordset")
sql="select * from Department where id=" & request("id")
rs.open sql,Conn,1,3
rs("name")=Request.Form("name")
rs.Update
rs.Close
response.write"提交成功!<script>location='Department.asp'</script>"
Set Conn=Nothing
end if
%>
提交后无法更新数据
我把 where id=" & request("id") 去掉就可以更新ID最大的那条记录 请问怎么回事? 展开
ID=Request.QueryString("ID")
Set rs=conn.Execute("select * from Department where ID="&ID)
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
<tr>
<td width="68%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">部门修改</span></div></td>
</tr>
<tr>
<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">
<form action="?action=save" method="post" id="form1">
<input name="name" type="text" id="name" value="<%=rs("name")%>" />
<input type="submit" name="button" id="button" value="提交" />
</form>
</div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30"> </td>
</tr>
</table>
</body>
</html>
<%
rs.Close
Set rs=Nothing
if request("action")="save" then
set rs=Server.CreateObject("ADODB.recordset")
sql="select * from Department where id=" & request("id")
rs.open sql,Conn,1,3
rs("name")=Request.Form("name")
rs.Update
rs.Close
response.write"提交成功!<script>location='Department.asp'</script>"
Set Conn=Nothing
end if
%>
提交后无法更新数据
我把 where id=" & request("id") 去掉就可以更新ID最大的那条记录 请问怎么回事? 展开
2014-10-27
展开全部
建议查看一下 request("id")的值,再做诊断
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询