how to show only 11 to 20 records out of 1000 records through jdbc
how to show only 11 to 20 records out of 1000 records
Collapse
X
-
Showing 1-10 records is done by a method of Statement Class named setMaxRows(int) . Code is as follows......
Code:import java.sql.*; class RecordFetcher { Connection cn=null; Statement stmt=null; ResultSet rs=null; RecordFetcher() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("jdbc:odbc:mydsn"); stmt=cn.createStatement(); stmt.setMaxRows(10); rs=stmt.executeQuery("select * from test"); while(rs.next()) { System.out.println(rs.getString(1)+" "+rs.getString(2)); } } catch(Exception e) { } } public static void main(String args[]) { new RecordFetcher(); } }Comment
Comment