Hi guys kindly tell me how to show data from database in to table?
and how to delete row from data base and table
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Hima BinduRank #4,292 · 353 reputationPosted Jul 17, 2016, 10:15 PM EDT
Follow these 3 steps
Load the data from the database
String sql="SELECT * FROM table";
ResultSet rs = st.executeQuery(sql);
Add each row of data to the table model...
while(rs.next())
{
String d = rs.getString("col1");
String e = rs.getString("col2");
String f = rs.getString("col3");
model.addRow(new Object[]{d, e, f});
}
Apply the model to your JTable
table.setModel(model);
Suthish NairRank #92 · 22.8K reputationPosted Jul 17, 2016, 10:54 PM EDT