jsp 下执行 sql 查询数组
我想查询复选框传过来的代码数组条件,在sql语句中查询名称,怎么不行,请大家帮忙看看,代码如下:
<%
String strsql="";
String strsqll="";
String[] dir = new String [100];
dir=request.getParameterValues("prsn_cd_h");
for(int i=0;i<dir.length;i++){
strsql = strsql + dir[i] + ",";
strsqll= strsqll + dir[i];
}
String filesql="";
filesql=filesql+"SELECT prsn_name FROM paa010t WHERE (prsn_cd IN ('"+strsqll+"')") ";
Statement stmt1 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rsfile=stmt1.executeQuery(filesql);
String str = "";
while(rsfile.next()){
str = str + rsfile.getString(1);
out.print(str);
}
%>
------解决方案--------------------