Javafxml application with datepicker, insert value in BD

Asked

Viewed 16 times

0

I have to enter the value of a datepicker that comes in DD-MM-YYYY format in the database and when I run the application I get this error: "com.microsoft.sqlserver.jdbc.Sqlserverexception: Operand type Clash: int is incompatible with date" I have declared the Datepicker and then will be called in the date insertion from a calendar

     @FXML
         DatePicker dataHoje;

     String SQLquery1 = "INSERT INTO Marcacao(IdMarcacao,IdUtente,IdServico,DataMarcacao)"
                            + "VALUES (" + id + "," + IdUtenteAgendar.getText() + "," + IdServicoAgendar.getText() + "," + dataHoje.getValue() + ");";
  • You repeat the same question I already closed as a duplicate. Please do not answer questions.

  • 1- You need to make sure that the return is really a type Date; 2- use preparedStatement and do not insert directly in the query; 3- see the links of the other duplicate, I believe they have the solution to your problem.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.