[nbusers] how to get all data in 1 column from database and display into textfield?

  • From: "sadsad_story" < >
  • To:
  • Subject: [nbusers] how to get all data in 1 column from database and display into textfield?
  • Date: Wed, 31 Oct 2012 04:45:02 -0400

private void getData(){
        try{
            String sql = "Select * from OrderList";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            if(rs.next()){
                String test = rs.getString("ItemName");
                jTextField1.setText(test);
            }
        }catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
}

above is coding to get data from database, but only the data from first row 
of the column.
what i want is get all data from 1 column and display into textfield. 
anyone know how to do it?






[nbusers] how to get all data in 1 column from database and display into textfield?

sadsad_story 10/31/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close