Quando clico em ''Salvar no banco de dados", é apontado o seguinte erro:
java.sql.SQLSyntaxErrorException: Erro de sintaxe: Encountered “where” at line 1, column 61.
Eis aqui o código-fonte do botão:
private void salvarActionPerformed(java.awt.event.ActionEvent evt) {
for (int i = 0; i < tabela.getRowCount(); i++) {
try {
PreparedStatement pst = c.conn.prepareStatement("update ESTADOS"
+ " set NOME_DO_ESTADO = ?, SIGLA_DO_ESTADO = ?,"
+ " where ID = ?");
pst.setInt(0, (int) tabela.getValueAt(i, 0));
pst.setString(1, (String) tabela.getValueAt(i, 1));
pst.setString(2, (String) tabela.getValueAt(i, 2));
pst.executeUpdate();
JOptionPane.showMessageDialog(null, "DEU CERTO!");
} catch (SQLException ex) {
Logger.getLogger(Inserção.class.getName()).log(Level.SEVERE,
null, ex);
JOptionPane.showMessageDialog(null, "Num vai dá não!\nERRO:"
+ " " + ex);
}
break;
}
}
OBS.: Usei o Netbeans 8.1.