求教. sql 批量修改数据不成功
以下代码可以运行,但批量修改数据不成功,不知错误在哪里<!--#include file=include.asp-->
<%
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
set rss=server.CreateObject("adodb.recordset")
sqls="select * from web_childorders Where Shopid='"&request.cookies("kkshopid")&"'"
rss.open sqls,conn,1,3
%>
<form name="orderChange" method="post" action="?act=update">
<table border="1" width="100%" id="table1">
<tr> <td>
<input type="submit" name="Submit3" value="Submit" onClick="return confirm('Confirm ?');">
</td></tr>
<tr> <td>Item Number</td> </tr>
<%
do while not rss.eof
if rss("C_state")>0 then
%>
<tr><td><input type=checkbox name="ck" value=<%=rss("orderid")%>> <%=rss("orderid")%> </td></tr>
<%
End if
rss.movenext
loop
%>
</table>
</form>
<%
if request("act")="update" and request("ck")<>"" then
''第一种方法,改不了任何数据
''conn.execute("update web_childorders set C_state=6 where orderid in ('"&request("ck")&"')")
''第二种方法,只改第一个数据
pid=request("ck")
mystr=split(pid,",")
for i=0 to ubound(mystr)
exec="update web_childorders set C_state=6 where orderid ='"&mystr(i)&"'"
conn.execute(exec)
next
response.write("Records has been updated")
end if
set rss=nothing
conn.close
set conn = Nothing
%>