java arraystoreexception_在JAVA项目中,调用方法时抛出java.lang.ArrayStoreException。求大神解惑??...

publicString[]selZlhisClass(StringclassName){Listlist=newArrayList();try{conn=ConnectionManager.getConnection();Stringsql="selectid,名称from部门...

public String[] selZlhisClass(String className) {

List list = new ArrayList();

try {

conn = ConnectionManager.getConnection();

String sql = "select id,名称 from 部门表 where 撤档时间=to_date('3000-01-01','yyyy-mm-dd') " +

"and id not in (select distinct 上级id from 部门表 where 上级id is not null) " +

"and 名称 like '%" + className + "%' order by 编码";

pste = conn.prepareStatement(sql);

res = pste.executeQuery();

System.out.println("sql语句:"+sql);

System.out.println("输入参数:"+className);

while (res.next()) {

Departments ds = new Departments();

ds.setNames(res.getString("名称"));

System.out.println("输出参数:"+res.getString("名称"));

list.add(ds);

}

} catch (SQLException sqle) {

sqle.printStackTrace();

} finally {

ConnectionManager.closeStatement(pste);

ConnectionManager.closeConnection(conn);

ConnectionManager.closeResultSet(res);

}

String[] goodsname = (String[])list.toArray(new String[list.size()]);

return goodsname;

}

展开


版权声明:本文为weixin_35524300原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。