给你个建议: 将id和quantity连成一个字符串。 eg:01/11 将其放入到checkbox的value中,注意车次开笔checkbox的名字起的相同eg:gua。提交 在下一页 guagua=request("gua"); aa=guagua.split(","); 则aa[0]就是01/11在分开 ok
这是偶刚做的,拿来给你看看可以否: delete.asp: <% i=1 do while not rs_all.EOF and i<=rs_all.PageSize theId = rs_all("Id")%> <tr height="33"> <td width="50" align="center"> <input type="checkbox" class =check name="ch" id="<%=theId%>" value="<%=theId%>"> </td> </tr> <% i = i + 1 rs_all.MoveNext loop %> 接受页面: theCount = Request.Form("ch").Count Redim check(theCount) for i=1 to theCount theCheck = Request.Form("ch")(i) check(i-1) = theCheck '把需要删除的全部发在数组里面 next value = "" for i = lbound(check) to ubound(check) value = value&","&check(i) '把数组里面的值与逗号组合成一个字符串 next value =left(value,len(value)-1) '去掉字符串右边的逗号 if instr(1,value,",",1) = 0 then Response.Write "选择错误,没有记录可以删除" Response.End end if
value =right(value,len(value)-1) '去掉字符串左边的逗号,得出如:2,3,5,6 似的字符串 sql_dele = "delete from product where Id in ("&value&")" conn.execute(sql_dele) '执行删除任务 conn.close set conn = nothing
将id和quantity连成一个字符串。
eg:01/11
将其放入到checkbox的value中,注意车次开笔checkbox的名字起的相同eg:gua。提交
在下一页
guagua=request("gua");
aa=guagua.split(",");
则aa[0]就是01/11在分开
ok
delete.asp:
<%
i=1
do while not rs_all.EOF and i<=rs_all.PageSize
theId = rs_all("Id")%>
<tr height="33">
<td width="50" align="center">
<input type="checkbox" class =check name="ch" id="<%=theId%>" value="<%=theId%>">
</td>
</tr>
<%
i = i + 1
rs_all.MoveNext
loop
%>
接受页面:
theCount = Request.Form("ch").Count
Redim check(theCount)
for i=1 to theCount
theCheck = Request.Form("ch")(i)
check(i-1) = theCheck '把需要删除的全部发在数组里面
next
value = ""
for i = lbound(check) to ubound(check)
value = value&","&check(i) '把数组里面的值与逗号组合成一个字符串
next
value =left(value,len(value)-1) '去掉字符串右边的逗号
if instr(1,value,",",1) = 0 then
Response.Write "选择错误,没有记录可以删除"
Response.End
end if
value =right(value,len(value)-1) '去掉字符串左边的逗号,得出如:2,3,5,6 似的字符串
sql_dele = "delete from product where Id in ("&value&")"
conn.execute(sql_dele) '执行删除任务
conn.close
set conn = nothing
先在第一个页面把checkbox的value存在隐藏text里面.
提交后由request.form("id")得到值.
在下一个页面"test.asp?id="&id