ASP批量修改问题,这是我做的一个测试页,想通过复选框选出来几条记录,然后把这些记录里的某个字段的值全
这是我做的一个测试页,想通过复选框选出来几条记录,然后把这些记录里的某个字段的值全改成某个值,现在这个改不了,求大神指导,本人菜鸟。。。<%no=request.Quer...
这是我做的一个测试页,想通过复选框选出来几条记录,然后把这些记录里的某个字段的值全改成某个值,现在这个改不了,求大神指导,本人菜鸟。。。
<% no=request.QueryString("no")
if no="yes" then
choice=trim(request.Form("choice"))
if instr(choice,",")>0 then
choicearr=split(choice,",")
for i = 0 to UBound(choicearr)
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from test where id='"&choicearr(i)&"'",conn,1,3
rs1("ps")="2"
rs1.update
rs1.close
set rs1=nothing
next
else
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select ps from test where id='"&choice&"'",conn,1,3
rs1("ps")="2"
rs1.update
rs1.close
set rs1=nothing
end if
end if %>
<form name="form" method="post" action="test.asp?no=yes">
<% set rs=server.CreateObject("adodb.recordset")
rs.open "select * from test",conn,1,1
do while not rs.eof %>
<input type="checkbox" name="choice" value="<%=rs("id")%>" /><%=rs("news")%><br />
<% rs.movenext
loop
rs.close
set rs=nothing %>
<input type="submit" name="submit" value="提 交" />
</form> 展开
<% no=request.QueryString("no")
if no="yes" then
choice=trim(request.Form("choice"))
if instr(choice,",")>0 then
choicearr=split(choice,",")
for i = 0 to UBound(choicearr)
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from test where id='"&choicearr(i)&"'",conn,1,3
rs1("ps")="2"
rs1.update
rs1.close
set rs1=nothing
next
else
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select ps from test where id='"&choice&"'",conn,1,3
rs1("ps")="2"
rs1.update
rs1.close
set rs1=nothing
end if
end if %>
<form name="form" method="post" action="test.asp?no=yes">
<% set rs=server.CreateObject("adodb.recordset")
rs.open "select * from test",conn,1,1
do while not rs.eof %>
<input type="checkbox" name="choice" value="<%=rs("id")%>" /><%=rs("news")%><br />
<% rs.movenext
loop
rs.close
set rs=nothing %>
<input type="submit" name="submit" value="提 交" />
</form> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询