Exception no comando Delete

2 respostas Resolvido
L

Estou tentando fazer a exclusão no Banco, entretanto estou recebendo essa Exception:
Exception:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELET FROM billets WHERE id=1' at line 1

Código:

public void delet(Billet object) {
		String sql = "DELET FROM billets WHERE id=?";
		try (Connection conn = new ConnectionFactory().getConnection()) {
			try (PreparedStatement stmt = conn.prepareStatement(sql)) {
				stmt.setInt(1, object.getId());
				stmt.executeUpdate();
			}
		} catch (SQLException e) {
			// TODO: Implementar Exception
			System.out.println("Não foi possível Excluir");
			e.printStackTrace();
		}
	}

2 Respostas

JuniorMaia
Solucao aceita

DELET não existe.

String sql = "DELETE FROM billets WHERE id=?";

L

Fiquei quase 2h sem perceber esse detalhe.

vlw

Criado 12 de fevereiro de 2016
Ultima resposta 12 de fev. de 2016
Respostas 2
Participantes 2