0

I want to populate my jtable with columns from different table in mysql database but it only displays the column names and not the data or information under those columns. i hope this code helps u undertand what i mean. thanks

private void Update_table(){
        try{
        String sql = "select Date_Acquired 'Date Acquired',Serial_Number 'Serial Number',Description 'Description',Cost_Of_Acquisition 'Cost Of Acquisition',Monthly_Depreciation 'Monthly Depreciation',Accumulated_Depreciation 'Accumulated Depreciation',Net_Book_Value 'Net Book Value',Branch_Area 'Branch Area',Depts_name 'Department Name',User 'User',Status 'Status' from items,branches,department_tbl,net_book_value,asset_update";
        pst = conn.prepareStatement(sql); 

        rs = pst.executeQuery();
        dep_report.setModel(DbUtils.resultSetToTableModel(rs));
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);

        }finally{
    try{
        rs.close();
        pst.close();
    }
    catch(Exception e){
    JOptionPane.showMessageDialog(null, e);      
    }
        }
    }  
2
Contributors
1
Reply
12
Views
4 Years
Discussion Span
Last Post by JamesCherrill
0

Since your resultSetToTableModel isn't part of the standard Java API its hard to know how solid it is.
Did you try printing from your result set to confirm that it has some data in it?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.