public boolean incluir(Fabricante fab) throws SQLException {
Conexao conexao = new Conexao();
PreparedStatement cstmt =
conexao.getConexao().prepareStatement("insert into fabricante values (?, ?) ");
cstmt.setString(1, fab.getNome());
cstmt.setString(2, fab.getTelefone());
//pegar o numero de registros inseridos
int registros = cstmt.executeUpdate();
//verificar se encontrou o registro
if (registros == 1) {
return true;
} else {
return false;
}
}
public boolean adicionarFabricante(Fabricante objFabricante) throws SQLException {
con = new Conexao();
PreparedStatement cstmt = con.getConexao().prepareCall("{call adicionar_fabricante(?,?)}");
cstmt.setString(1, objFabricante.getNome());
cstmt.setString(2, objFabricante.getTelefone());
cstmt.execute();
cstmt.close();
int registros = cstmt.executeUpdate();
if (registros == 1){
return true; }
else {
return false; }
estou usando o odbc e o banco e o sql server