This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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 rinkuraj@yahoo.com thanks in Adavance Rinku
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
"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
Raj
vikinsa
Ranch Hand
Joined: Apr 18, 2001
Posts: 46
posted
0
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 rinkuraj@yahoo.com 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.
Thnx
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
posted
0
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
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.