0
In my database I have a table called "Matrices". In this table I record the livestock matrices I own 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 matrix with the existing number, it does not save.
I was looking for a way to make my system more efficient, making it so that as soon as I typed the number to register a new matrix, it would do a search in my database and if it returned some value, block the registration, and if it does not return any value, let the matrix register continue.
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 you’re making a mistake
Incompatible types: void cannot be converted to Boolean
this field should be Auto Increment no ?
– Luís Almeida
Heitor, your application is web or desktop?
– Elexsandro Rangel dos Santos
The application is desktop
– Heitor Calaça Manoel Ferreira
Luis, the field cannot be Auto Increment, because the number is I who must choose.
– Heitor Calaça Manoel Ferreira
Hector, this latest edition of yours seems like an attempt at a response. Reverti removing the post but you can post an answer in the "Post an answer" field instead of posting as a question edit.
– user28595