Please help, my Prog is compiling fine but when run it give me
Exception in thread "main" java.lang.NullPointerException
with the following:
1) at PatientReg.displaySQLErrors(PatientReg.java:424)
private void displaySQLErrors(SQLException e) {
errorText.append("SQLException: " + e.getMessage() + "\n");
errorText.append("SQLState: " + e.getSQLState() + "\n");
errorText.append("VendorError: " + e.getErrorCode() + "\n");
}
2) at PatientReg.loadAccounts(PatientReg.java:69) the line in bold
private void loadAccounts() {
Vector v = new Vector();
try {
rs = statement.executeQuery("SELECT * FROM PatientTable");
while (rs.next()) {
v.addElement(rs.getString("patienNo"));
}
} catch (SQLException e) {
[B] displaySQLErrors(e);[/B]
}
PatientNumberList.setListData(v);
}
3) at PatientReg.buildGUI(PatientReg.java:79)
loadAccounts();
called within the buildGUI() method
4) at PatientReg.main(PatientReg.java:441) the line in bold
public static void main(String[] args) {
PatientReg patient = new PatientReg();
patient.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
patient.init();
[B]patient.buildGUI();[/B]
}
}
Thanks in advance for your help and if you happen to need the whole project I'll be glad to provide.