Dear sir, i want to display 10 records per page from my data base usinf JSP technology i want to know, can i write any sql query for that or i have write seprate coding . pls do send any coding you have that in this mail id email@example.com thanks in Adavance Rinku
Joined: Jan 07, 1999
"Rinku", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements. Thanks.
There is no Query to display 10 records at a time.. Fetch all records...
and manage the 10 records...per ..page in JSP page... Seeya
Joined: Apr 18, 2001
Take the problem like this way.... 1. Start a counter.. int intCount=0; 2. Prepare a query and Fetch the resultset String query="select name from emp"; ResultSet rs=stmt.executeQuery(query); 3. Retrive the values from the result set
5. use vector as data source. 6. In the next ietration update the initial value of count to 10 and the value in the if loop to 20. This can be done dynamically.
Originally posted by Rinku: Dear sir, i want to display 10 records per page from my data base usinf JSP technology i want to know, can i write any sql query for that or i have write seprate coding . pls do send any coding you have that in this mail id firstname.lastname@example.org thanks in Adavance Rinku
Dear vikinsa The solution u r givan for ritu problem will work with small amount of data but when u are acsseing huge data (may be 50000 or more than that) then u can't store data in to vector or collction, so how can i display records page by page.With ResultSet.
Peter den Haan
Joined: Apr 20, 2000
Originally posted by Raja Shekhar: There is no Query to display 10 records at a time..
Sure there is. To display records n through m for a query: Standard SQL-92: SELECT * FROM tables a WHERE whereclause AND (SELECT COUNT(*) FROM tables b WHERE whereclause AND b.orderby_fields < a.orderby_fields) BETWEEN n AND m ORDER BY orderby_fields Oracle: SELECT * FROM tables WHERE whereclause AND ROWNUM BETWEEN n AND m ORDER BY orderby_fields - Peter