Jump to content

Netbeans JTable and resultset

- - - - -

  • Please log in to reply
No replies to this topic

#1
Timinator

Timinator

    Newbie

  • Members
  • Pip
  • 6 posts
After getting my MS SQL connection working and I'm returning a valid resultset, I now need to figure out how to get my existing JTable to see the resultset.

    public SMAdmMgrRepView() {

        String[] header = new String[] {

            "Manager Name",

            "CUID",

            "Rep. Name",

            "Type",

            "Su",

            "Mo",

            "Tu",

            "We",

            "Th",

            "Fr",

            "Sa"

        };

        String tSQL = "Select * from TMSM_Staff";

        Object [] [] data = null;

        try {

            ResultSet rs = SMDatabase.RunSQL(tSQL);

        }

        catch (Exception e) {

            e.printStackTrace();

            System.out.println("Error Trace in getConnection() : " + e.getMessage());

        }


        initComponents();  //

        //set the default column widths

        tblMgrRepList.setAutoResizeMode(tblMgrRepList.AUTO_RESIZE_OFF);

        TableColumn col = null;

        //code for column sizing is here

    }


 /**WARNING: Do NOT modify this code. The content of this method is

     * always regenerated by the Form Editor.*/

    @SuppressWarnings("unchecked")

    // <editor-fold defaultstate="collapsed" desc="GeneratedCode">                          

    private void initComponents() {

         //All the form and layout components are initialized here


    }// </editor-fold>             


I've stripped out all the generated code for readability.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users