满足条件时在表格中显示值

时间:2015-02-04 03:57:15

标签: java swing

如果Adminaccount_type,我需要在我的jTable中显示1的值,如果是Cashier,则需要2。请帮帮我..这是我的片段:

    private void Update_table() {
        try{

    String sql = "SELECT idno as 'User ID', username as 'Username', password as 'Password', account_type as 'Account_Type' from user";

    st = con.createStatement(rs.TYPE_SCROLL_SENSITIVE, 
                rs.CONCUR_UPDATABLE);

    rs = st.executeQuery(sql);


   while(rs.next())
   {
    if(rs.getInt(4)==1)
    {
        rs.updateString(4, "1");

    }
    viewUserTable.setModel(DbUtils.resultSetToTableModel(rs));
    viewUserTable.setRowSelectionAllowed(true);

    viewUserTable.setSelectionMode(SINGLE_SELECTION);
    viewUserTable.setAutoResizeMode(5);
   }

0 个答案:

没有答案