MysorePak Posted June 3, 2014 Report Posted June 3, 2014 Hi all i am facing a problem how to put result set in array okka method lo query run chesthuna then adhi oka column with data vasthundhi so adhi nenu array list lo ela pettali and display that list in JSP here is the method where i am running query public String getabc value(){ Connection con = null; PreparedStatement ps = null; ResultSet rs = null; String xyz= null; String sql = "SELECT ID from EMPLOYEE"; try{ con = getConnection(); ps = con.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()){ ekkada ela run cheyali aa list value and how to capture and return array }
bisketraja Posted June 3, 2014 Report Posted June 3, 2014 List<String> idList = new ArrayList<String>(); declare chesi while loop lo idList.add(rs.getString(1)) ani pettukoni idList return cheyochemo... Calling experts.....
alpachinao Posted June 3, 2014 Report Posted June 3, 2014 try{ con = getConnection(); ps = con.prepareStatement(sql); List<?> l = new ArrayList<?>() rs = ps.executeQuery(); while(rs.next()){ l.add(rs.getString("ColumnName"); }
joblessjack Posted June 3, 2014 Report Posted June 3, 2014 try{ con = getConnection(); ps = con.prepareStatement(sql); List<?> l = new ArrayList<?>() rs = ps.executeQuery(); while(rs.next()){ l.add(rs.getString("ColumnName"); } corestt
MysorePak Posted June 3, 2014 Author Report Posted June 3, 2014 Thanks Bhayya try{ con = getConnection(); ps = con.prepareStatement(sql); List<?> l = new ArrayList<?>() rs = ps.executeQuery(); while(rs.next()){ l.add(rs.getString("ColumnName"); }
MysorePak Posted June 3, 2014 Author Report Posted June 3, 2014 Syntax error on token(s), misplaced construct(s) vasthundhi at l.add(rs.getString("ColumnName"); deggara
MysorePak Posted June 3, 2014 Author Report Posted June 3, 2014 no errors just nenu braces thappu petta.. epudu test chesthanu
Recommended Posts