还是给思路把。
用js
用一hidden
提交form前循环检查
那一个checkbox[i].checked==true
hidden.value+=checkbox[i].value+",";
然后把最后一个,去掉下一页delete ****** where id in hidden
就行了。本人一向慷慨大方,守信用,up 有分!
欢迎讨论。
用js
用一hidden
提交form前循环检查
那一个checkbox[i].checked==true
hidden.value+=checkbox[i].value+",";
然后把最后一个,去掉下一页delete ****** where id in hidden
就行了。本人一向慷慨大方,守信用,up 有分!
欢迎讨论。
删除记录scjl.jsp
out.println("<form action=take_scjl.jsp>");
while(rs.next())
{
out.println("<input type=checkbox name=check_id value='"+rs.getInt("id")+"' >");
out.println(rs.getString("address"));
}
out.println("</form>");在take_scjl.jsp中
Connection conn=...;
conn.setAutoCommit(false);
Statement st = conn.createStatement();
for(int i=0;i<id.length;i++)
{
int intId = Integer.parseInt(id[i]);
sql = "delete from table1 where id='"+intId+"'";
st.addBatch(sql);
}
st.addBatch(sql);
int[] rowAffect = st.executeBatch();
conn.commit();
conn.setAutoCommit(true);
还有 addBacth()
executeBatch() 没有用过,不知道,能不能说说。。
本人一向慷慨大方,守信用,up 有分!
欢迎讨论。