java - How to display selected columns of database in a Jtable? -
i populated jtable
contents of database table want show selected columns of it. there way of doing this? or possible select column display in jtable
?
here method of populating jtable
private void update_table() { try { string sql = "select * members"; ps = conn.preparestatement(sql); rs = ps.executequery(); members_table.setmodel(dbutils.resultsettotablemodel(rs)); } catch (exception e) { joptionpane.showmessagedialog(null, e); } }
my database table name "members". "members_table" name of jtable
.
you try changing sql statement select columns interested in. instance, if members has columns "memberid", "memberfirstname", "memberlastname" "memberaddressfk", , wanted display memberfirstname , memberlastname, change sql
string sql = "select memberfirstname, memberlastname members";
you can find more details sql select statement @ http://beginner-sql-tutorial.com/sql-select-statement.htm
Comments
Post a Comment