ASP 批量更新修改的字段内容(ACCESS)
<%dimUserID,sql,rsUserID=trim(Request("ID"))idArr=split(UserID)kddh=requ...
<%dim UserID,sql,rsUserID=trim(Request("ID"))idArr=split(UserID)kddh=request.form("kddh")if userid="" thenresponse.write"<script language=javascript>alert('未选择任何订单!');history.go(-1);</script>" else for i = 0 to ubound(idArr)sql="update xinxi set ckkddh='"kddh"' where ID="&clng(idarr(i)) conn.Execute sqlnextresponse.write"<script language=javascript>alert('已修改所选订单!');history.go(-1);self.location=document.referrer</script>" end if conn.close set rs=nothing set conn=nothing %>____________________________通过多选框.提交多条所选页面字段 kddh 过来本页...然后批量修改..现有的语句o循环有点问题想破脑袋.希望高手帮忙..
展开
展开全部
idArr=split(UserID)有错,应该是: idArr=split(UserID,",")
不过不建议使用你那方法,有个更简单的:
<%
Dim userId,sql,rs,kddh
userId=request.form("ID")
kddh=request.form("kddh")
If userid="" Then
response.write"<script>alert('未选择任何订单!');history.back();</script>"
Else
conn.Execute("update xinxi set ckkddh='"&kddh&"' where ID in("&userId&")")
response.write"<script>alert('已修改所选订单!');self.location=document.referrer;</script>"
End If
rs.close
Set rs=Nothing
conn.close
Set conn=Nothing
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询