and i would like my data to show like this: MySql table but i only get this: java
I used this query:
GROUP_CONCAT(a.montant, a.type_avance,a.date_avance,a.remark SEPARATOR '\n') as Avance
and it works just fine in MySql but it doesn't work in jframe.
this my java code:
//declaring the table
tb_imp_pr = new JTable();
tb_imp_pr.setRowHeight(50);
tb_imp_pr.setBackground(Color.WHITE);
scrollPane.setViewportView(tb_imp_pr);
// filling the table
public void filltable_pr() {
try {
connectore.statement = connectore.connection.prepareStatement("SELECT i.*,GROUP_CONCAT(a.montant,"
+" a.type_avance,a.date_avance,a.remark SEPARATOR '\n') as Avance "
+" FROM info_impayee i LEFT JOIN avance a ON i.n_dossier = a.n_dossier GROUP by i.n_dossier,i.date_dossier");
connectore.resultSet = connectore.statement.executeQuery();
tb_imp_pr.setModel(DbUtils.resultSetToTableModel(connectore.resultSet));
} catch (Exception ex) {
System.out.println();
}
}
thanks to @camickr i know that i need to use "br" and have text before and after the "br"
public void filltable_pr() {
try {
connectore.statement = connectore.connection.prepareStatement("SELECT i.*,GROUP_CONCAT('<html>',a.montant,"
+" a.type_avance,a.date_avance,a.remark SEPARATOR '<br></html>') as Avance "
+" FROM info_impayee i LEFT JOIN avance a ON i.n_dossier = a.n_dossier GROUP by i.n_dossier,i.date_dossier");
connectore.resultSet = connectore.statement.executeQuery();
tb_imp_pr.setModel(DbUtils.resultSetToTableModel(connectore.resultSet));
} catch (Exception ex) {
System.out.println(ex);
}
}