473,395 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to show only 11 to 20 records out of 1000 records

3
how to show only 11 to 20 records out of 1000 records through jdbc
Feb 28 '10 #1
3 1433
jkmyoung
2,057 Expert 2GB
Could you show the code to display records 1 - 10? Then we can customize your code a lot easier.
Mar 1 '10 #2
dcbtux
3
Showing 1-10 records is done by a method of Statement Class named setMaxRows(int). Code is as follows......
Expand|Select|Wrap|Line Numbers
  1. import java.sql.*;
  2. class RecordFetcher
  3. {
  4.     Connection cn=null;
  5.     Statement stmt=null;
  6.     ResultSet rs=null;
  7.     RecordFetcher()
  8.     {
  9.         try
  10.         {
  11.             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  12.             cn=DriverManager.getConnection("jdbc:odbc:mydsn");
  13.             stmt=cn.createStatement();
  14.             stmt.setMaxRows(10);
  15.             rs=stmt.executeQuery("select * from test");
  16.             while(rs.next())
  17.             {
  18.                 System.out.println(rs.getString(1)+" "+rs.getString(2));
  19.             }
  20.         }
  21.         catch(Exception e)
  22.         {
  23.         }
  24.     }
  25.     public static void main(String args[])
  26.     {
  27.         new RecordFetcher();
  28.     }    
  29. }
  30.  
Mar 1 '10 #3
jkmyoung
2,057 Expert 2GB
I'm not sure if it's supported, but can you add

"LIMIT 10 OFFSET 10"
to your query string?

Or have you looked at getMoreResults()?
Mar 2 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Hennie de Nooijer | last post by:
Hi, Currently we're a building a metadatadriven datawarehouse in SQL Server 2000. We're investigating the possibility of the updating tables with enormeous number of updates and insert and the...
4
by: Brian | last post by:
Hi there I'm not so hot on JavaScript so not sure if this can be done. I have a PHP page that runs a MySQl query, while these queries are running I would like to show a message saying...
1
by: MLH | last post by:
I have a challenge... In a table I call tblStuff4Letters with 3 fields: , and . I have a report called rptOutboundCorrespondence that feeds off this table. Sorting & grouping is turned on in...
11
by: Vivek Sharma | last post by:
Hi There, I am building a web application.ASP.NET using C#. I have 1000 candidates out of which I has to be selected. The way I can present is having a dropdown list but I think 1000 records...
4
by: Chris | last post by:
Any good routines or suggestions to assist me in re-ordering my records in my datagrid? i.e. I have a field in each record that is used for ordering (i.e. 1,2,3,4). I would like to implement a...
2
by: NTPT | last post by:
I have this table content (id int8,owner int8,position int8,timestamp int8,description text,batch int8) Table is inserted/deleted frequently, 'id' is almoust random. I insert to the...
5
by: valglad | last post by:
Hi, The question below was posted about 4 years ago and noone was able to answer it back then. I have virtually the same type of problem so would appreciate if anyone can help. Thanks ...
4
by: J | last post by:
I am editing a pre-existing view. This view is already bringing data from 40+ tables so I am to modify it without screwing with anything else that is already in there. I need to (left) join it...
1
by: rbg | last post by:
I am using derived tables to Page data on the SQL Server side. I used this link as my mentor for doing paging on the SQL Serverhttp://msdn2.microsoft.com/en-us/library/ms979197.aspx I wanted to...
5
by: Twanne | last post by:
Hi I wrote this function: Function UpdateLongfunctieFEVFVC() Set db = CurrentDb Dim percfev As Double Dim percfvc As Double Set rst = db.OpenRecordset("SELECT eadnr, datum,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.