String sql= "select name from emplyoo ";
.
.
.
.
.
while(rs.next()) {
rs.getString(1);
}
打印结果有多个,我该怎样获取每个值并附给不同的变量呢?
在线等,搞定给分
------解决方案--------------------
你可以把取到的值封装到bean中然后再封装到 List里面..返回..
String sql= "select * from student ";
-----
List <Student> list=new ArrayList() <Student> ;
while(rs.next()){
Student st=new Student();
st.setName(rs.getString(1));
st.setAge(rs.getString(2));
list.add(st);
}
return list;
------解决方案--------------------
String sql= "select * from student ";
...
List list=new ArrayList();
while(rs.next()){
String s = rs.getString(1);
list.add(s);
}