DEV Community

ADITYA MOHARANA
ADITYA MOHARANA

Posted on

how can i do that!

i have a table in database and i want to display some specific data in java jTable how i can do that.
Code is:
`

`
public void Tablelist2() {
try {
String sql = "SELECT AccountNo, transaction_id, transaction_type, transaction_date, transaction_amount FROM transaction";
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
jTable2.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
} finally {
try {
rs.close();
pst.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
}

`
`


Enter fullscreen mode Exit fullscreen mode

Top comments (0)