Error in my code??
843859Apr 16 2006 — edited Apr 16 2006- I cant figure out wheres my error coz NetBeans 5.0 states Exceptionjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
Can someone here please check for me.. My presentation to my course supervisor is this Thursday.. Heres my code. Cheers mate!
********************************************************************
private void bttn_updateActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try{
Connection con=null;
Statement sm=null;
ResultSet rs = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Estate");
sm = con.createStatement();
sm.executeUpdate("UPDATE RealEstateOffice " +
"SET officeNumber = ' " + oNo.getText() + "'," +
"name = ' " + oName.getText() + "'," +
"officeManagerName = ' " + oManager.getText() + "'," +
"address = ' " + oAdd.getText() + "'," +
"phone = ' " + oPhone.getText() + "'," +
"fax = ' " + oFax.getText() + "'," +
"WHERE officeNumber = ' " + oNo.getText() + "' ");
rs.close();
sm.close();
con.close();
}
catch(Exception e){
System.out.println("Exception"+e);
}
}