散50分求一JSP问题答案
我做了一个下拉菜单,下拉菜单里显示的是在规定时间里库存里的车辆,但现在有个问题:因为我的车子和
司机是绑定的,但是库里肯定存在没有跟司机绑定的车子啊,我现在要把没和司机绑定的车去掉不显示,我的这个SQL语句怎么改呢?代码如下:
<tr> <td align= "right "> 可选车辆: </td> <td> <select name= "carId ">
<%
Connection con=dataConnection.getConnection();
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery( "select carId from form where (start <# "+start+ "# and end> =# "+start+ "#) or (start> =# "+start+ "# and start <=# "+end+ "#) ");
Collection ret=new ArrayList();
while(rs.next()){
ret.add((String)rs.getString( "carId "));
}
Collection col=carBean.getCarId(carType);
col.removeAll(ret);
Iterator it=col.iterator();
while(it.hasNext()){
String s=(String)it.next();
out.println( " <option > "+s+ " </option> ");