Bill Arse
Posts: 1
Nickname: syphon1982
Registered: Apr, 2003
null pointer exception in JBuilder
Posted: Apr 9, 2003 5:06 AM
Advertisement
I keep getting a null pointer exception when trying to use the following code. Any ideas? void SubmitToTesterButton_actionPerformed(ActionEvent e) { String query4; String query8; String query9; boolean more; boolean dbErrors = false; // i want the boolean solved to be turned to yes and // then to send the problem to the tester panel' list table //query4 = "INSERT INTO Problem(Solved) "+ // " VALUES ('Yes') "; //connection.executeUpdate(query4); query8 = "INSERT INTO ProblemHistory(ProblemNo,RecieveDate, DeployDate)"+ " VALUES ( "+ProbNum+",'"+dateRecText.getText()+"','"+TextFixed.getText()+"')"; connection.executeUpdate(query8); query9 = "SELECT MAX(TaskNo)"+ " FROM ProblemHistory"; try { ResultSet rs; //dbConnection connection = new dbConnection(); int num; String name; rs = connection.executeQuery(query9); more = rs.next(); num = rs.getInt("Expr1000"); System.out.println(num); if (!more) { JOptionPane.showMessageDialog(this,"This requested data does not exist" ,"Access Denied" ,JOptionPane.ERROR_MESSAGE); return; } more = rs.next(); //connection.closeConnection(); } catch (SQLException error) { JOptionPane.showMessageDialog(null,"Error creating connection: " +error.getMessage(),"Error",JOptionPane.ERROR_MESSAGE); //An error occurred, so set the error flag dbErrors = true; } query4 = "INSERT INTO Programmer(TaskNo, SolutionDetails)"+ " VALUES ("+num+",'"+solutionText.getText()+"' )"; connection.executeUpdate(query4) ; }