In my database I have a table called "Matrices". In this table I make a record of the livestock matrices that I have on the farm, and each matrix has its respective number, which is stored in the "Number" column of the table. This column is UNIQUE in the database, so if I try to save a new array with the existing number, it does not save. I was looking for a way to make my system more efficient, so that as soon as I type the number to register a new matrix, it would search my database and if it returns any value, it blocks the registration, and if it does not returns no value, lets you proceed with the matrix register.
Edit: I created this code:
private void txtnumeroFocusLost(java.awt.event.FocusEvent evt) {
MatrizesDAO dao = new MatrizesDAO();
if(dao.verificarNumero(evt.getComponent().toString())){
JOptionPane.showMessageDialog(this.rootPane, "Numero já cadastrado");
} else {
}
}
but is giving the error
Incompatible types: void can not be converted to boolean