java - JTable not showing data -
i have got problem. connect mssql java. return data sql.i want show jtable data didnt assign jtable defaulttablemodel. code:
public void displaytable(resultset result,resultsetmetadata resultmeta){ int i; defaulttablemodel table = new defaulttablemodel(); int columncount=resultmeta.getcolumncount(); system.out.println(columncount); try{ for(i=1;i<=columncount;i++) table.addcolumn(resultmeta.getcolumnname(i)); while(result.next()){ string [] row=new string[columncount]; for(int j=1;j<=columncount;j++) row[j-1]=result.getstring(j); table.addrow(row); } for(int =0;a<columncount;a++){ system.out.println(table.getcolumnname(a)); } tablo.setmodel(table); }catch(exception ex){ system.out.println(ex); } }
Comments
Post a Comment