import java.sql.ResultSet;import java.sql.SQLException;import dao.Basedao;public class Dobaidu extends Basedao{public String[] baidu(String a){ String sql1="select * from baidu where content like ?"; String sql2="select count(*) from baidu where content like ?"; ResultSet rs=super.qurry(sql1, new Object[]{"%" + a + "%"}); ResultSet rst=super.qurry(sql2, new Object[]{a}); String[] c = null; try { if(rst.next()){ int b=rst.getInt(1); c=new String[b]; int i=0; while(rs.next()){ c[i]=rs.getString(2); } i++; }else{ c=new String[1]; c[0]="fied"; } } catch (SQLException e) { e.printStackTrace(); } super.close(); return c;}}我这个有什么错??运行报 c[i]=rs.getString(2); 的错outof.....
添加回答
举报
0/150
提交
取消