如果Admin
为account_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);
}