?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;}}我這個(gè)有什么錯(cuò)??運(yùn)行報(bào)?c[i]=rs.getString(2); ?的錯(cuò)outof.....
添加回答
舉報(bào)
0/150
提交
取消