(May be u r looking for this vkarthik SIR)
/* FIRST PREVIOUS NEXT LAST
________________________ */
TRY USING THIS CODE
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import java.util.*;
public class JDBC1 extends Frame implements ActionListener
{
Label l1,l2,l3,l4;
Button b1,b2,b3,b4;
TextField t1,t2,t3;
String drive;
Connection c;
String du;
String sql;
int max=0,p1;
int i=1;
String arr1[][] = new String[100][4];
public JDBC1()
{
setLayout(null);
l1=new Label("QUERY FORM"

;
l2=new Label("Ecode"

;
l3=new Label("Name"

;
l4=new Label("Salary"

;
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
b1=new Button("first"

;
b2=new Button("previous"

;
b3=new Button("next"

;
b4=new Button("last"

;
l1.setBounds(200,30,100,40);
l2.setBounds(20,80,150,20);
l3.setBounds(20,120,150,20);
l4.setBounds(20,160,150,20);
t1.setBounds(200,80,250,20);
t2.setBounds(200,120,250,20);
t3.setBounds(200,160,250,20);
b1.setBounds(150,470,100,40);
b2.setBounds(250,470,100,40);
b3.setBounds(350,470,100,40);
b4.setBounds(450,470,100,40);
this.add(l1);
this.add(l2);
this.add(t1);
this.add(l3);
this.add(t2);
this.add(l4);
this.add(t3);
this.add(b1);
this.add(b2);
this.add(b3);
this.add(b4);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
try{
drive="sun.jdbc.odbc.JdbcOdbcDriver";
Driver dr=(Driver)Class.forName(drive).newInstance();
Properties p=new Properties();
/* fa1 is the name of the dsn created in control panel 32odbc by using database of access2000*/
du="jdbc

dbc:fa1";
c=dr.connect(du,p);
Statement stmt=c.createStatement();
String s ="select * from Table2";
ResultSet result=stmt.executeQuery(s);
this.setSize(300,300);
this.show();
while(result.next())
{
arr1
[1]=result.getString(1);
arr1[2]=result.getString(2);
arr1[3]=result.getString(3);
i++;
max=i-1;
}
}catch(SQLException e)
{
System.out.println("Error" + e);
} catch(Exception ee)
{
System.out.println("Error "+ ee);
}
for(int i=0;i<=max;i++)
{
for(int j=0;j<=3;j++)
{
System.out.println(arr1[j]);
}
}
}
public void actionPerformed(ActionEvent e)
{
// FIRST
if(e.getSource()==b1)
{
t1.setText(arr1[1][1]);
t2.setText(arr1[1][2]);
t3.setText(arr1[1][3]);
i=2;
}
//NEXT
if(e.getSource()==b3)
{
if(i<=max && i >=1)
{
t1.setText(arr1[1]);
t2.setText(arr1[2]);
t3.setText(arr1[3]);
p1=i-1;i++;
}
}
//PREVIOUS
if(e.getSource()==b2)
{
if(p1<=max && p1 >=1)
{
t1.setText(arr1[p1][1]);
t2.setText(arr1[p1][2]);
t3.setText(arr1[p1][3]);
p1--;
i=p1;
}
}
// LAST
if(e.getSource()==b4)
{
t1.setText(arr1[max][1]);
t2.setText(arr1[max][2]);
t3.setText(arr1[max][3]);
p1=max-1;
}
}
public static void main(String ar[])
{
JDBC1 J= new JDBC1();
}}
FROM
RISHU CHOPRA