hi all.
i have a program , now i add Operator manager to add new operator and get list of operator or delete
now Add and Delete is work fine but my ResultSet dont work and give me Null pointer Exeption
ths code in Operatormanager Class
public ArrayList<Operator> getlist() throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException{ operators = null; operator= null; Command_msg = "SELECT * FROM operator"; dbmanager.getConn(); Statement st = dbmanager.conn.createStatement(); ResultSet res = st.executeQuery(Command_msg); while(res.next()){ operator.setName(res.getString("Name")); [COLOR=Red]// here is exeption[/COLOR] operator.setUsername(res.getString("Username")); operator.setPassword(res.getString("Password")); operators.add(operator); } return operators; }
and this code is in Display class
OPManager.getlist(); int i = 0; for (Core.Operator emp : operators) { Table.setValueAt(emp.getName(), i, 0); Table.setValueAt(emp.getUsername(), i, 1); Table.setValueAt(emp.getPassword(), i, 2); i++; }
i waiting to your Answer.