日期:2014-05-20 浏览次数:20963 次
String[] chkId = request.getParameterValues("projectId");
String sql = "delete from t_student where checkbox=?";
String sql2 = " or checkbox=?";
Connection conn = ....;
PreparedStatement pstmt = ....;
pstmt = conn.prepareStatement(sql);
for(int i=0;i<chkId.length;i++){
//假想的实现功能
sql = sql + sql2*(chkId.length-1);
}
delete from t_student where checkbox =? or checkbox=? or checkbox=?......
String sql = "delete from t_student where 1=1";
String condition = "AND checkbok in (";
for(int i=0;i<chkId.length;i++){
condition += "?,"
}
condition = condition.subString(0, condition.length() - 1);
condition += ")"