So I have this code right here:
try {
rs = stmt.executeQuery("SELECT * FROM systemaccount where ID = '"+getValue+"'");
while(rs.next())
{
fname.setText(rs.getString("First_Name"));
mname.setSelectedItem(rs.getObject("Middle_name"));
lname.setText(rs.getString("Last_Name"));
address.setText(rs.getString("address"));
contact.setText(rs.getString("Contact_Number"));
user.setText((String) getValue((Integer) rs.getObject("User"), "user"));
usertype.setSelectedItem(getValue((Integer) rs.getObject("user_type"), "user_type")); //<-----THE ERROR IS HERE
}
} catch (SQLException ex) {
Logger.getLogger(SystemAccount.class.getName()).log(Level.SEVERE, null, ex);
System.out.println(ex.getMessage());
}
So basically what my code does is that when I double clicked on the jTable
it automatically populates the ComboBox
and TextFields
as well. But MySQL
throws an error that it doesn't find any user_type
column name.
As you can see below I have proof that it has a column name named user_type
.
systemaccount table having user_type column
and I always get
java.sql.SQLException: Column 'user_type' not found. error on the line usertype.setSelectedItem(getValue((Integer) rs.getObject("user_type"), "user_type"));
any hint on what's going on?